JSP or servlet will use the page to jump, you can use Request.getrequestdispatcher ("p3.jsp"). Forward (request,response); This method is called forwarding, the URL on the address bar does not change; Response.sendredirect ("p3.jsp"), this method is called redirection, the URL of the address bar will change, so that the implementation jumps to p3.jsp, but the two methods are essentially different, Requset is the request, is running on the server side, Response is the corresponding, is running on the client; For example: There are 3 pages p1.jsp, p2.jsp, p3.jsp; P1.jsp submitted to p2.jsp, p2.jsp is forwarded to p3.jsp if in P2 with the first method sent to P3, because the browser is requesting P2, some of the requested parameters are encapsulated in the request, sent to the server, Server with Request.getrequestdispatcher ("p3.jsp"). Forward (Request,response); <br> go to P3, send P3 to the browser, the browser does not know is rescue, so the URL is p2.jsp, also can be used Request.getparameter ("name"); Get the value of the form control in p1.jsp because here forward () is used to pass the request down as in the second method, this is the browser unsolicited P3, so the browser knows the requested address, so the URL changed, and another request, There is another request, which is different from requesting P2, so use the Request.getparameter ("name") in P3, not the value of the form control in p1.jsp Summary: 1, Request.getrequestdispatcher ("a.jsp"). Forward (Rquest,response); Request forwarding It can save the data page in the request adjustment but the address is not adjusted 2, Response.sendredirect ("b.jsp"); The way to redirect it is that the data is not shared, which means that the data saved in the request is not available in the B.jsp page, which is that the form cannot be submitted repeatedly, and the respons jump is a cross-domain address bar that can also be changed  
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.