JSP Syntax (9)

Source: Internet
Author: User
Tags expression
js| Syntax jsp:forward>

redirect an HTML file, JSP file, or a program segment.



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>

Describe

<jsp:forward> tags from a JSP file to another file to pass a request object containing the user requested the .<jsp:forward> tag code below, will not be executed.



You can transfer parameters and values to the target file, in this case we pass the parameter named Username, the value is Scott, if you use the <jsp:param> tag, the target file must be a dynamic file to handle the parameters.



If you use a non buffered output, be careful when using <jsp:forward>. If the JSP file already has data before you use <jsp:forward>, the file execution error occurs.



Property

Page= "{relativeurl | <%= expression%>}"

Here is an expression or a string that describes the file or URL you are going to orient. This file can be a JSP, a program segment, or any other file that can process the request object (such as asp,cgi,php).



<jsp:param name= "ParameterName value=" {parametervalue | <%= expression%>} "/>+

Send one or more parameters to a dynamic file, which must be a dynamic file.



If you want to pass multiple parameters, you can use multiple <jsp:param> in a JSP file. NAME specifies the parameter name, and value specifies the parameter 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.