JSP programming (II)-JSP basic syntax (7)-JSP: Forward

Source: Internet
Author: User

Redirects an HTML file, JSP file, orProgramSegment.

 JSP syntax

<JSP: Forward page = {"Relativeurl"|" <% =Expression%> "}/>

Or

<JSP: Forward page = {"Relativeurl"|" <% =Expression%> "}>

<JSP: Param name ="Parametername"

Value = "{Parametervalue| <% =Expression% >}"/> +

</Jsp: Forward>

 Example

<JSP: Forward page = "/servlet/login"/>

<JSP: Forward page = "/servlet/login">

<JSP: Param name = "username" value = "jsmith"/>

</Jsp: Forward>

Description

<JSP: Forward> the tag transfers a request object containing user requests from one JSP file to another. <JSP: Forward>Code, Cannot be executed.

You can send parameters and values to the target file. In this example, the parameter name is username and the value is Scott. If you use the <JSP: param> label, the target file must be a dynamic file that can process parameters.

If you use non-buffered output, be careful when using <JSP: Forward>. If the JSP file already has data before you use <JSP: Forward>, the file execution will fail.

Attribute
    • page = "{ relativeurl | <% = Expression %>}"

      here is an expression or string used to indicate the file or URL to be targeted. this file can be JSP, program segment, or other files (such as ASP, CGI, PHP) that can process request objects ).

    • +

      send one or more parameters to a dynamic file, this file must be a dynamic file.

      if you want to pass multiple parameters, you can use multiple In a JSP file. Name: Specifies the parameter name and value.

Related Article

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.