Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

jsp:forwardand response.sendRedirect  RSS feed

 
Nadeem Ahmad
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I want to know the diffrence between thsese two redirecting tag.
Actually i hv read the difference in many BOOK and on sites also.But I cud not able to know that where we shud use response.sendRedircet and where <jsp:forward></jsp:forward>.
How i can i see the differenrc when I run Both.
Plzz tell me the case in which only one them can work..it is neccasary to use the specific one.
 
Erik Pragt
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, but a search on this forum, or google, would probably reveal more than 100 questions which are all the same as this one.
Before giving you an answer, please take the effort to use the forum search, or google search.
Thank you.
Erik
 
Nadeem Ahmad
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I hv searched many times and i got the solution in the Bokks also but as I hv eritten that i cud not get the correct one.
Actaully i told in an interview the same thing which i hv read in the books and on the Net.
Plz tell me where can we use these url redirection specificly
 
Murali Mohan
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Redirect---> transfer control to any url in the web.
Forward---->it works with in the container.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it's actually a little deeper than that.
When you perform a redirect, the response is sent back to the browser with headers that instruct the browser to create a new request to the redirect URL. The important part of this is that a redirect causes the current request to end, and a new one to be generated, perhaps elsewhere.
A forward sends the current request to another resource within the web application. The forward does not return a response to the browser, and no new request is generated.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!