Chinese garbled solution in JSP or servlet:1. By Post Request method:Set before getting the request parameter:Request.setcharacterencoding ("Utf-8");To set the output encoding:Response.setcontenttype ("Text/html;charset=utf-8");or
2. Request in a
form is the form, and the double quotes are filled with the path you want to submit to this form. (another page, for example).
Method= "POST" refers to the way of submission, which means that the submission is not displayed in the Address bar when
The action in the form form here fills in the action= "/aaa/hello/login" where AAA is the same value in the path that is deployed on Tomcat, which can be said to be a logical map: as shown in the following figure
**********************
JSP Four scopes:Page: The current page, that is, just jump to another page will not be validRequest: A conversation, simple understanding is a request within the scope of the effectiveSession: Browser process, as long as the current page is not
JSP nine kinds of built-in objects: request, reponse, out, session, Application, config, PageContext, page, exception.
A. Request object: The object encapsulates the information submitted by the user, and it is possible to obtain the encapsulated
In the development process, it is often used repeatedly in the Select Load Dictionary table data, such as loading jobs, education and so on, each time to use a separate acquisition and then traverse the front end will be cumbersome, and inconsistent
Reproduced from: http://www.cnblogs.com/hellofei/archive/2010/02/02/1662070.html
The difference between JSP forwarding and redirection
Http://blog.csdn.net/CYHJRX/archive/2009/02/26/3938252.aspx
For a long time did not look, and the foundation
Simply put,--js is performed on the client and requires a browser to support JavaScript. The JSP is executed on the server side and requires a server program on the server that supports the servlet. JS code is able to directly from the server
JSP jumps to the servlet:
1. note that the URL here cannot directly write your servlet name, but to fill out the url-pattern of the servlet in Web.xml, namely "/xxxservlet" form. There are slashes, slashes, staves. In addition, this way directly
one, JSP nine large built-in objects
The JSP has predefined 9 such objects, namely, request, response, session, application, out, PageContext, config, page, exception
1. Request Object
The Request object is an object of type
The introduction of the jquery plugin in the JSP page is mainly the path problem introduced below, there are three ways:
1 . Create the JSP file directly under the Wetroot, put the jquery-1.7.js into a new folder: as shown:
The code to introduce
Summary:
This paper first introduces a JSP's source file execution process, that is, after three stages, two times coding, to complete a complete output. It is particularly noteworthy that in this process, the coding problem runs throughout. We know
Deploying Project Web in Eclipse sometimes accessing a JSP throws the following similar exception informationOrg.apache.jasper.JasperException:The Absolute uri:http://java.sun.com/jspDeploy the Web project if this exception is thrown. Please ensure
The number of words in the JSP form that controls the display of characters, and the ellipsis is used instead
First introduce struts2 label
5" >
... Show omitted characters when mouse moves to ellipsis
JSP gets the session value problem from the action there are several ways:
For example, I have a session in action ("SessionID", "11111111")
First, use the struts tag to obtain:
Second, session is also one of the built-in objects, you can use
Solution:
Step 1. Add a filter, that is, in the filter in init () plus request.setcharacterencoding ("Utf-8"), the equivalent of each page encoding is utf-8,
Step 2. Change the form submission method to post mode, as far as the get way is
1, scope implicit objects-built-in map implementation, setattribute, GetAttribute,
1, pagescope page scope pagecontext– stored content can only be valid within the current page scope
2, Requestscope request scope request– can only be valid within
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.