• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

RequestDispatcher vs Response.sendRedirect

 
Nikita Dutt
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Am a newbie in J2EE , have this small doubt in RequestDispatcher and Response.sendRedirect ; as per my book doing a forward using a request dispatcher will not create a new request object but with Response.sendRedirect a new request object gets created. My doubt is .. Is it possible i can route a request to different servlet in different J2EE container using RequestDispatcher ? If yes will i be still be having the old request object with me ?

I am working on building a sample code to see if it works ; but for now was curious to get too the answer and logic behind.


Thanks in advance
Nikita
 
Joseph Mokenela
Ranch Hand
Posts: 66
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are still having the request object because if you say , you forward the same request to the jsp.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. You cannot forward outside of the current web app.
 
Joseph Mokenela
Ranch Hand
Posts: 66
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear,

Thank you for correcting me, i think i didn't read the question properly, i was under the impression that we are still inside the same web app.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64720
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joseph Mokenela wrote:Thank you for correcting me, i think i didn't read the question properly, i was under the impression that we are still inside the same web app.

Is it possible i can route a request to different servlet in different J2EE container using RequestDispatcher ?
 
Nikita Dutt
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to both of you
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic