1. Instruction <%@%>
(1) Page directive
defining properties for an entire page by setting multiple properties inside
Syntax: <%@ page Property 1 = "Property Value" Property 2 = "Property value 1, property value 2" ... Property N= "Property value N"%>
Page directive Common Properties:
Example: <%@ page language= "java" contenttype= "TEXT/HTML;CHARSET=GBK"%>
(2) include directive
The contains actions that can be included in some duplicate code to continue to be used. This type of inclusion is called "Static containment."
syntax: <% @include file= "file path to include"%>
For example:
<%@ include file=include1.jsp "%>
<jsp:include/>
2.JSP Standard Action
(1) <jsp:include/>
can include other files, which are included in the dynamic inclusion
Syntax:
parameter not passed: <jsp:include page= "{file path to include}"/>
Passing parameters
<jsp:include page= "{file path to include}" >
<jsp:param name = "parameter name 1" value = "parameter content 1"/>
<jsp:param name = "Parameter Name 2" VALUE = "parameter Content 2"/>
... Multiple parameters can be passed to the contained page
</jsp:include>
(2) Static inclusion differs from dynamic inclusion
static includes:
include1.jsp page
<span style= "FONT-SIZE:18PX;" ><%int x =;%>
include2.jsp page
<span style= "FONT-SIZE:18PX;" ><%@ page contenttype= "text/html" pageencoding= "GBK"%>
when the program runs with 500 HTTP status code, which is a server error, X is repeatedly defined. While observing the JSP
Engine compiled Java file: Only one Java file has been generated. Therefore, the static contains the first containing the following
The form of the rationale.
Dynamic includes:
<span style= "FONT-SIZE:18PX;" ><%@ page contenttype= "text/html" pageencoding= "GBK"%>
The program runs without errors, dynamically including if it contains a dynamic page, with the first processing after the inclusion form.
3. <jsp:forward/>
from the current page to the specified page, jump operation belongs to the server-side jump, the page path after the jump is not
Change
Syntax:
parameters are not passed
<jsp:forward page = "file path to include" >
Passing parameters
<jsp:forward page = "file path to include" >
<jsp:param name = "parameter name" VALUE = "parameter Contents"/>
... Multiple parameters can be passed to the contained page
</jsp:forward>
For example:
Forward2.jsp for post-jump pages
<span style= "FONT-SIZE:18PX;" ><%@ page contenttype= "text/html" pageencoding= "GBK"%>
forward1.jsp the page where the jump occurred
<pre name= "code" class= "HTML" ><span style= "font-size:18px;" >
Basic knowledge of JSP Syntax (ii)