Jsp learning notes: Action instructions, jsp learning notes instructions
Jsp: forward:
Statement 1:
<jsp:forward page="jspPage2.jsp"/>
Statement 2:
<jsp:forward page="jspPage2.jsp"> <jsp:param name="val" value="1000"/></jsp:forward>
In statement 2, <jsp: param name = "val" value = "1000"/> is used to upload additional data to jspPage2.jsp. The name is val, data with a value of 1000. On the jspPage2.jsp page, you can obtain the request using the built-in object, for example:
<%=request.getParameter("val")%>
Note: jsp: When forward specifies a page, jsp expressions can also be used, such:
<jsp:forward page=<%=nextPage%>/>
Include:
Dynamically import a page in the same format as forward.
Differences from static import:
1. In servlet, static import integrates the two into a complete Servlet, while dynamic import uses the include method to import page content
2. During static import, the Compilation instruction on the imported page is valid, while dynamic import will invalidate it. Only the part of its body is inserted into the current page.
3. Add additional data (param action) for dynamic import)
UseBean:
Instantiate a java class
<jsp:useBean id="name" class="className" scope="page | request | session | application">
Id: Instance name class: scope of the class to be implemented: scope of action (page: This page is valid; request: this request is valid; session: This session is valid; application: valid in this application)
SetProperty:
Set the property value of a java instance
<jsp:setProperty name="name" property="propertyName" value="val">
Name: instance name property: property name value: property value
GetProperty:
Obtain the property value of a java instance.
<jsp:getProperty name="name" property="propertyName">
Plugin:
Used to download the server's javaBean or Applet
Param:
Add additional data, applicable to the following action commands: include, forward, and plugin