In Jsp and Servlet, when traverse between Jsp page and Servlet, there are two ways:
1. using jsp:forward
2. using response.sendRedirect(url)
here is the summary of the each method:
jsp:forward
<jsp:forward page= “success.jsp”;
in this way, the request will be transftered down, all the attributes in the previous request can be accessed in the new page.
However, there is one problem that, the url of the new page won't be displayed in the IE address bar, user can not see the url address
response.sendRedirect(url)
in this way, there will be one new request created for the direction, in the new page, user can't access the attributes in the previous request, if you want to share any value in the request, redirection won't be the best way.
And what is more, the new url address will be displayed in the IE address bar.
However, since the url will be displayed in the IE address bar, so there is one new problem that: you must do some check for the case of error usage of the url page.