The common small knowledge point finishing of Java EE

Source: Internet
Author: User

1. Get the Project path: Request.getcontextpath ();

2. Get the requested parameter: Request.getquerystring ();

3. Specify the character encoding format for the request: Urlencoder.encode (text, "UTF-8");

Configure the servlet parameter in 4.web.xml,
<init-param>
<param-name>xx</param-name>
<param_value>yy</param_value>
</init-param>
To read this parameter in the servlet, override the Init method

5.${} represents a JSP built-in object

6.<%%>jsp Small Script

7.java.lang.threadlocal.get () method returns the value in the current thread copy of this thread's local variable

8. Determine if a string array contains a string:

such as: string[] ss = {"1", "2", "3"};
String s = "1";
Boolean Iscontanis = Arrays.aslist (ss). contain (s);
9. String interception

Example: String str = "All-in-all"
sring[] STRs = Str.split (","); split string by specified character
Str.substring (2); intercept from the specified index bit to the end, subscript starting from 0
Str.substring (2,4); intercept from start index bit to end index bit, contains start index does not contain end index

10. Get the file name when uploading: File.getoriginalfilename ()

11. In the JSP page, if you need to format the date format from the background, you can use
<fmt:formatdate value= "${biztoservice.addtime}" type= "both" pattern= "Yyyy-mm-dd HH:mm:ss"/>

12.fn:replace () function syntax: ${fn:replace (< original string;, < substituted string, < string to replace >)}

The 13.<c:url> tag formats the URL as a string and then stores it in a variable.

such as: <c:url value= "/xfspcontroller/broswer.do" var= "Pageurl" >
</c:url>

The common small knowledge point finishing of Java EE

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.