JSP tutorial (6)-how to jump to another page in JSP _ MySQL

Source: Internet
Author: User
Use jspforwardAction in JSP to redirect pages. Syntax: jsp: forwardpage {relativeURL | % expression %} or jsp: forwardpage {relativeURL | % expression %} jsp: paramnameparameterNamevalue {parameterValue | % expression %} + jsp: the forward action uses JSP forward Action in jsp to implement the page jump function.

Syntax:

Or

Value = "{parameterValue | <% = expression % >}"/> +

This action allows you to forward the request to another page. It has only one attribute, page. Page should contain a relative URL. This can be a static value or a value that can be calculated when it is requested, as shown in the following two examples:




! SupportEmptyParas]>

Here is a specific example: use forward in test1.jsp to jump to the test2.jsp page.

Test1.jsp


Forward test
! SupportEmptyParas]>

! SupportEmptyParas]>





! SupportEmptyParas]>
Test2.jsp


Forward test
! SupportEmptyParas]>

! SupportEmptyParas]>

<% Out. println ("This is the output on the jsp2.jsp page"); %>


! SupportEmptyParas]>
Run test1.jsp and you can see the output information in the browser: "This is the output from the jsp2.jsp page. But what if you pass parameters on the test1.jsp and test2.jsp pages? The get method is not only inconvenient but also insecure. In fact, we can use the para attribute provided for forward in jsp1.1 to solve this problem. Test3.jsp and test4.jsp are used to describe.

! SupportEmptyParas]>
Test1.jsp


Forward test
! SupportEmptyParas]>

! SupportEmptyParas]>



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.