February 25, 2008 at 1:43 PM
Difference between jsp forward and sendRedirect
JSP forward action (<jsp: forward/>)
jsp forward action transfers the control to a static or dynamic resource. The static or dynamic resource to which control is transferred is represented as a URL. The user can forward the control to an HTML file, another JSP file, or a servlet. It should be noted that the target file must be in the same application context as the forwarding JSP file.
sendRedirect() method of a response object sends the url to the browser that includes the parameter of sendRedirect() method Browser treats this a new request from the client. sendRedirect() forwards a requests to a resource outside of the current web application. Using sendRedirect is similar to open a new browser and type your url. A sendRedirect() also updates the browser history and transfers control only when the whole service method completes. There is only one way to pass data is through the session or using web parameters (url?name=value).
February 25, 2008 at 1:49 PM