sendRedirect must be used when redirecting to a page outside the current context. for instance, I could not forward a request from my domain to a page inside www.javaranch.com.
Also, you should use sendRedirect when you want to ensure that the url is exposed to the user. For instance, if the client needs the ability to bookmark the page, you should use sendRedirect.
Also, when switching protocalls, like from http to https, I believe you need to use a sendRedirect as well.
“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
If i want something in my application should be handaled by some other web-application may be built by somebody else, for which i am not responsible in those cases I should use send redirect. For example say my application wants currency coversion from USD to EURO then calling the yahoo finance with my currency amount may solve my problem using send redirect. [ October 21, 2005: Message edited by: subho saha ]
Joined: Oct 11, 2004
Thanks a lot Paul and Subho.
Paul, I think you are prepared to strike SCWCD. All the best.
Joined: May 24, 2004
Paul, I think you are prepared to strike SCWCD. All the best. thanks rathi! I've been "preparing" for a while, but right when I was ready to take it, I change jobs and moved across country... so I've been putting it off. I need to get my butt in gear again though!
It's also a way to make the browser to a GET. The POST-redirect-GET pattern has the browser POST an update then GET a fresh view of the changed data. The user can bookmark the view page or refresh it without repeating the POST. I think this is more consistent with the REST view of web architecture; POST should update the resource and GET should show it to you.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi