| Author |
SendRidirect vs RequestDispatcher
|
Sandipan Mukherjee
Greenhorn
Joined: Dec 07, 2006
Posts: 8
|
|
|
Tell me the difference between response.sendRedirect and requestDispatcher.forward with respect to session?
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
With respect to session, there is little difference between the two. In general, they are very different. requestDispatcher.forward takes place on the server, within one request cycle. The client (browser) has no idea that this has taken place. response.sendRedirect works by sending a 302 header (along with a Location header), suggesting that the browser make a brand new request.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Prabhu Venkatachalam
Ranch Hand
Joined: Nov 16, 2005
Posts: 502
|
|
The client (browser) has no idea that this has taken place.
you can notice, in browser URL bar, URL will not change while you are doing forward but if you do redirect you can see that changing.
|
Prabhu Venkatachalam<br />SCJP 1.4,SCWCD 1.4<br />prabhu.venkatachalam@gmail.com
|
 |
 |
|
|
subject: SendRidirect vs RequestDispatcher
|
|
|