One. JSP template elements
The static HTML content in a JSP page is called a JSP template element
Two. JSP expressions (expression)
A simplified way of outputting the computed result of a Java variable or expression to the client, and the variable or expression it will output is directly encapsulated in <%= and%>
The result of a variable or expression in a JSP expression is converted to a string and then inserted into the corresponding location of the entire JSP page output.
A variable or expression in a JSP expression cannot be followed by a semicolon (;), and the JSP expression is translated into a out.print (...) in the servlet program. Statement
Three. JSP script fragment (Scriptlet)
One or more Java program code nested within <% and%>
The Java code in the JSP script fragment will be moved unaltered into the _jspservice method of the servlet translated by the JSP page, so that the JSP script fragment can only be a program code that conforms to the Java syntax requirements.
Any text, HTML tags, and other JSP elements that are outside of the script fragment are also converted into the appropriate Java program code to be inserted into the _jspservice method, with the location of the script fragment unchanged
The Java code in the JSP script fragment must strictly follow the Java syntax, for example, after each command execution statement must end with a semicolon (;)
There can be multiple script fragments in a JSP page (each script fragment code is nested between separate pairs of <% and%>), and text, HTML tags, and other JSP elements can be embedded between two or more script fragments.
Code in multiple script fragments can access each other
The Java statements in a single script fragment can be incomplete, but the result of a combination of multiple script fragments must be a complete Java statement
Four. JSP declaration
JSP declaration encapsulates Java code in <%! And%>, the code inside it will be inserted outside the servlet's _jspservice method.
JSP declarations can be used to define static code blocks, member variables, and methods for a servlet program that is converted to a JSP page (almost unused in JSP)
Five. JSP annotations
<%--Comment Information--%> jsp comments
The JSP engine ignores the annotated content in the JSP page when translating the JSP page into a servlet program
<!--comment information--HTML comment
The difference: JSP annotations can annotate Java code, and HTML annotations can not
JSP basic Knowledge _2