First:
<Script language = "JavaScript" type = "text/JavaScript">
Window. Location. href = "login. jsp? Backurl = "+ window. Location. href;
</SCRIPT>
Second:
<Script language = "JavaScript">
Alert ("return ");
Window. History. Back (-1 );
</SCRIPT>
Third:
<Script language = "JavaScript">
Window. navigate ("Top. jsp ");
</SCRIPT>
Fourth:
<Script language = "JavaScript">
Self. Location = "top.htm ";
</SCRIPT>
Category 5:
<Script language = "JavaScript">
Alert ("illegal access! ");
Top. Location = "XX. jsp ";
</SCRIPT>
Sixth:
Servlet jump --> request. getrequestdispatcher ("/WEB-INF/pages/error. jsp"). Forward (request, response );
7:
Because the above redirects are all under webroot, or the complete URL address is known. if HTML or JSP is stored in the WEB-INF, in the case of struts, you can get the complete URL address by configuring the struts path, do not use struts to achieve page Jump under the WEB-INF...
/** <Br/> * @ author Vicky <br/> * @ emial eclipser@163.com <br/> */<br/> public class navigateto extends httpservlet {</P> <p> Private Static final long serialversionuid = 1l; </P> <p> Public void doget (httpservletrequest request, httpservletresponse response) throws servletexception, <br/> ioexception {<br/> string url = request. getparameter ("url"); <br/> request. getrequestdispatcher (URL ). forward (request, response); <br/>}</P> <p> Public void dopost (httpservletrequest request, httpservletresponse response) throws servletexception, <br/> ioexception {<br/> doget (request, response); <br/>}</P> <p>}
Web. xml configuration:
<Servlet>
<Servlet-Name> navigateto </servlet-Name>
<Servlet-class> CN. Vicky. servlet. navigateto </servlet-class>
</Servlet>
Page used:
<%
String Path = request. getcontextpath ();
%>
<SCRIPT type = "text/JavaScript">
Function playgame ()
{
Window. Location. href = "<% = PATH %>/servlet/navigateto? Url =/WEB-INF/pages/game. jsp ";
}
</SCRIPT>
<Input type = "button" value = "enter the game" $ {sessionscope. User = NULL? "Disabled = 'false'": ""} onclick = "playgame ();"/>