Java web Development Series jsp knowledge outline, javajsp
1. Working Principles of jsp
When the client form submits the request to the jsp page, the Server jsp Engine finds the jsp file from the server disk. Parse it into a java file, compile the java file into a class file, and then execute the class file to process the request. After processing, an html file is generated, and the jsp engine sends the html file to the client for display.
2. jsp file
A typical jsp file includes the following five elements:
A. Notes
B. template Elements
C. script elements
D. command element
E. Action elements
3. jsp file elements
1) Comment in JSP file
A. HTML comment
Return to the source HTML of the client to see this annotation.
B. JSP comments
When the jsp file is parsed as a java file, this annotation will be deleted, and will not appear in the source HTML.
C. java annotations
This annotation is retained when the jsp file is parsed as a java file.
2) template Elements
In jsp, the static html part is the template element part, which is the main body of jsp files. Background programmers do not need to care too much about this part. Generally, this part is completed by the artist.
3) script elements
These elements are divided into three categories:
A. Statement
Use <%! %> Identifier, mainly used to define methods or variables.
B. Expression
Use the <% = %> identifier to output the result of the method or the value of the variable as a string.
C. Script
Marked with <%>.
4) command element
There are three types of command elements. They are page commands, include commands, and taglib commands, which are identified by the symbol <% @ %>.
5) Action elements
The action element is identified by the tag <jsp: XXX>.
4. jsp built-in objects
1) Output object out
2) Get the request Object request
3) return the client request object response
4) session object session
5) Context object pagecontext
6) application Object
7) exception information object exception
8) config
9) page