There are two methods for JSP page jumps: the Requestdispatcher.forward () method and the Httpservletresponse.sendredirect () method.
The difference between them is:
Requestdispatcher.forward () method is only a control in the container of the steering, in the client browser address bar will not show the turn of the address, he will not change the value of the request, if you need to be in the next page to get new information from the words, You can Request.setattribute () to place some flags so that they are retrieved from the next page. The wording reads as follows:
try{
request.getRequestDispatcher("display.jsp").forward(request,response);
}
catch(Exception e){
e.printStackTrace();
}
Httpservletresponse.sendredirect () is a complete jump, the browser will get the address of the jump, and resend the request link. In this way, you can see the link address after the jump from the address bar of the browser. The wording reads as follows:
Response.sendredirect ("display.jsp");
In contrast, the Requestdispatcher.forward () method is more efficient, using the request Dispatcher.forward () method as much as possible when it meets the needs, and it also helps to hide the actual links.