• Post Reply Bookmark Topic Watch Topic
  • New Topic

response.sendRedirect()

 
Zoram Paul
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the purpose of response.sendRedirect()?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll tell you what it does and then, maybe you can tell us how it would be useful to you.

A redirect sends a 30x response code to the browser along with a 'Location' header containing the URL for the resource that you wish the browser to request.
In effect, what your telling the browser is "What you're looking for isn't here. Try this location.".
 
Zoram Paul
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It has redirect me to a new world.

 
mukthala vijay kumar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
send redirect is useful to send a req to resource which is availabe in another webcontailer.
When the browser send a req to the server ,it creates req and res object ok then,
when the method sendredirect got executed the webcontainer creates another request and response object for calling the resource.

response.sendRedirect("url callingservlet ");
this case you cen also give the url which is running on the another webcontainer
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by mukthala vijay kumar:
When the browser send a req to the server ,it creates req and res object ok then, when the method sendredirect got executed the webcontainer creates another request and response object for calling the resource.


Just to make sure we're all on the same page: the browser sends the request, and the server asnwers with the redirect response. Then the browser sends another request to a different server.
 
Zoram Paul
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok..
Thank you all, it has cleared my doubts now.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!