- forward behavior:
- Control is transferred entirely on server. No network traffic is involved.
- The user does not see the address of the destination JSP page and pages can be placed in web-inf to prevent the user from accessing them without going through servlet that sets up the data. This is beneficial if the JSP page makes sense only in the context of servlet-generated data.
- sendRedirect behavior:
- Control is transferred by sending the client a 302 status code and a Location on response header. Transfer requires an additional network round trip.
- The user see the address of the destination page and can bookmark it and access it independently. This is beneficial if the JSP is designed to use default values whendata is missing. eg, this approach would be used when redisplaying an incomplete HTML form or summarizing the contents of a shopping cart. In both cases, previously create data would be extracted from the user's session, so the JSP page makes sense even for requests that do not involve the servlet.