Basic JSP syntax knowledge
1. JSP comments
Comments in JSP are classified into two categories:
Explicit comment: (Increase the transmission burden and minimize the usage)
Implicit comment:
Format 1: // single line comment
Format 2:/**/single-line or multi-line comment
Format 3: <% -- JSP annotation, invisible to the client -- %> JSP Annotation
Example:
Compile a JSP file that contains the preceding three annotations
Signature + signature/Signature + oaLJ + signature/Cw + signature + CjwvcD4KPHA + signature + sLrJT48YnI + CjwvcD4KPHA + signature ++ signature/Signature + signature + sLru + signature + Cw + csn5w/e3vbeoo6zL + dLUsrvE3NTa0KG9xbG + large/cjno7o8L3A + large/small = "http://www.2cto.com/uploadfile/Collfiles/20150104/20150104091250243.png" alt = "\">
(2) Declaration: <%! Method %>
Compile defines global constants, writing method, but cannot be directly in <%! %> Write any common statement in it because this section is JSP
The engine is converted into a method in the class.
Note: JSP built-in objects cannot be used in this part.
For example:
Declare a method for formatting the date and call it to display the current date.
(3) expression: <% = %>
Outputs a variable or specific content.
For example:
Use out. print () and expression to print ten rows and ten columns of tables on the page. which method is better.
Out. print () output:
Expression output: it is more concise and the front-end code is more regular. Therefore, this method is recommended.