Expression contains an expression that conforms to JSP syntax
JSP syntax
<% = Expression%>
example
<% = map.size ()%> font>
<% = number> b>.
Description / R
Expression elements indicate a expression that is defined in the scripting language, which is automatically converted to a string after running, and then inserted into this expression of the JSP file display. Because the value of this expression has been converted to a string, you can insert this expression in a line of text (the form and ASP is exactly the same).
Remember the following: When you use an expression in JSP:
You can't use a semicolon (";") as an expression of the expression. But the same expression is used in the scriptlet! View Scriptlet
This expression element can include any active expression in Java Language Specification.
Sometimes the expression can also be an attribute value of other JSP elements. An expression can become complicated, it may consist of one or more expressions, these expressions are from left to right.
[/ b] scriptlet [/ b]
Contains an effective block.
JSP syntax
<% Code Fragment%>
example
<%
String name = NULL;
IF (Request.GetParameter ("name") == null) {
%>
<% @ Include file = "Error.html"%>
<%
} Else {
Foo.setName (Request.GetParameter ("name");
IF (foo.getname (). EqualsignoreCase ("Integra"))
Name = "acura";
IF (name.equalsignorecase ("acura")) {
%>
Description / R
A scripTlet can include multiple JSP statements, methods, variables, expressions
Because Scriptlet, we can do the following things:
Declare the variables or methods to be used (reference declarations).
Write a JSP expression (reference expression).
Use any implicit objects and any objects that use
Write a JSP statement (if you are using Java language, these statements must follow Java Language Specification,).
Any text, HTML tag, JSP element must be outside Scriptlet
When JSP receives a customer request, the scriptlet will be executed if the scriptlet has the content displayed, and the contents of these display are existing in the OUT object.
Include instruction
Contains a static file in the JSP while parsing the JSP statement in this file.
JSP syntax
<% @ Include file = "relativeURL"%>
example
INCLUDE.JSP:
<% @ Page import = "java.util. *"%> <% = (New java.util.date ()) .tolocalestring ()%>
Displays in the page:
THE CURRENT DATE AND TIME ARE
Aug 30, 1999 2:38:40
Description / R
<% @ include%> The instruction will insert a file containing text or code when the JSP is compiled. When you use <% @ include%> instruction, this containing process is static. Static container means that this file containing files will be inserted into the JSP file. This containable file can be a JSP file, an HTML file, a text file. If included is a JSP file, the code in this file containing the JSP will be executed.
If you just use INCLUDE to include a static file. The result of this containing files will be inserted into the JSP file where you are <% @ include%>. Once the included file is executed, the process of the primary JSP file will be recovered and the next line is proceed.
This containing files can be HTML files, JSP files, text files, or just a java code, but you have to pay attention to , html>,
, body> tag in this included file Because this will affect the same tag in the original JSP file, so sometimes it will cause errors.There are some <% @ include%> Directance behavior is based on special JSP compilation conditions, such as:
This included file must be open to all customers and must be valid, or it has secure limitations.
If this included file is changed, the JSP file containing this file will be recompiled.
Attributes:
FILE = "relativeurl"
This containing file path name is generally referring to the relative path, no port, protocol, and domain name, as follows:
"Error.jsp" "Templates / Onlinestore.html" "/ beans / calendar.jsp"
If this path starts with "/", this path is primarily referring to the up and down relationship path of the JSP application. If the path starts with a file name or directory name, then this path is the current path of the JSP file being used.