js| Tutorial | Page JSP using the JSP forward action to achieve the page's jump function.
Grammar:
or
Value= ' {parametervalue|<%= expression%>} '/>+
This action allows you to move the request to a different page. It has only one attribute, page. The page should consist of a relative URL. This can be a static value or a value that can be computed at the time of the request, as in the following two examples:
!supportemptyparas]>
Here's a concrete example: use forward in test1.jsp to jump to the test2.jsp page.
test1.jsp
forward Test
!supportemptyparas]>
!supportemptyparas]>
!--Jump to test2.jsp--!
!supportemptyparas]>
test2.jsp
forward Test
!supportemptyparas]>
!supportemptyparas]>
<%out.println ("This is the output produced by the jsp2.jsp page");%>
#@62;
!supportemptyparas]>
Run test1.jsp, you can see in the browser: "This is the output from the jsp2.jsp page" output information. But what if you have parameters in both the test1.jsp and test2.jsp pages? Get Way bar, not only the total length is limited, the use is now very inconvenient, and sometimes not safe. In fact, we can use the jsp1.1 in the forward to provide the Para properties can be resolved. Now the test3.jsp and test4.jsp to explain.
!supportemptyparas]>
test1.jsp
forward Test
!supportemptyparas]>
!supportemptyparas]>
!supportemptyparas]>
test2.jsp
forward Test
!supportemptyparas]>
!supportemptyparas]>
<%
Out.println ("This is the output from the jsp4.jsp page" + "
");
Out.println ("Name:" +request.getparameter ("name") + "
");
Out.println ("Add:" +request.getparameter ("address") + "
");
!supportemptyparas]>
%>
Run test3.jsp, you can see the output information in the browser:
"This is the output produced by the jsp4.jsp page
Name: Powerman
Address: No. 188th West Street, Beijing