Use JSP forward action in JSP to achieve the page's jump function.
Grammar:
<jsp:forward page= "{relativeurl|<%= expression%>}"/> or
<jsp:forward page= "{relativeurl|<%= expression%>}" >
<jsp:param name= "ParameterName"
Value= "{parametervalue|<%= expression%>}"/>+</jsp:forward>
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:
<jsp:forward page= "/utils/errorreporter.jsp"/>
<jsp:forward page= "<%= somejavaexpression%>"/>
!supportemptyparas]>
Here's a concrete example: use forward in test1.jsp to jump to the test2.jsp page.
test1.jsp
<HTML>
<HEAD>
<title>forward test</title>
!supportemptyparas]>
</HEAD>
!supportemptyparas]>
<body bgcolor= "#FFFFFF" >
<!--jump to test2.jsp--! >
<jsp:forward page= "/test2.jsp"/>
</BODY>
</HTML>
!supportemptyparas]>
test2.jsp
<HTML>
<HEAD>
<TITLE> forward Test </TITLE>
!supportemptyparas]>
</HEAD>
!supportemptyparas]>
<body bgcolor= "#FFFFFF" >
<%out.println ("This is the output from the jsp2.jsp page");%>
</BODY>
</HTML>
!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
<HTML>
<HEAD>
<TITLE> forward Test </TITLE>
!supportemptyparas]>
</HEAD>
!supportemptyparas]>
<body bgcolor= "#FFFFFF" >
<jsp:forward page= "/test4.jsp" >
<jsp:param name= "name" value= "Powerman"/>
<jsp:param name= "Address" value= "Beijing West Street No. 188th"/>
</jsp:forward>
</BODY>
</HTML>
!supportemptyparas]>
test2.jsp
<HTML>
<HEAD>
<title>forward test</title>
!supportemptyparas]>
</HEAD>
!supportemptyparas]>
<body bgcolor= "#FFFFFF" >
<%
Out.println ("This is the output from the jsp4.jsp page" + "<br>");
Out.println ("Name:" +request.getparameter ("name") + "<br>");
OUT.PRINTLN ("Address:" +request.getparameter ("addr") + "<br>");
!supportemptyparas]>
%>
</BODY>
</HTML>
Run test3.jsp, visible in the browser:
"This is the output produced by the jsp4.jsp page
Name: Powerman
Address: No. 188th West Street, Beijing
The output information