Jsp learning notes: Action instructions, jsp learning notes instructions

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.