Forward Vs Redirect August 12, 2006
Posted by :) in J2EE.trackback
A Controller servlet may perform either a forward or a redirect operation at the end of processing a request.
Forward
- forward is performed internally by the servlet
- the browser is completely unaware that it has taken place, so its original URL remains intact
- any browser reload will simple repeat the original request, with the original URL
Redirect
- redirect is a two step process, where the web application instructs the browser to fetch a second URL, which differs from the original
- a browser reload of the second URL will not repeat the original request, but will rather fetch the second URL
- redirect is always slower than a forward, since it requires a second browser request
- beans placed in the original request scope are not available to the second request
Forward should be used if the operation can be safely repeated upon reload; otherwise, redirect must be used. Typically, if the operation performs an edit on the datastore, then a redirect, not a forward, is required.


[...] is an interesting blog regarding Forward vs Redirect This entry is filed under Struts. You can follow any responses to this entry through the RSS 2.0 [...]
Marvellous explanation. But just provide an example of both the methodology.
forward and include
Briefly explain what these two methods do and when you would use one or the other. You can use a picture to illustrate the different message paths.
Answer?
[...] Forward Vs Redirect [...]
cool, thanks!