aspose file tools*
The moose likes Servlets and the fly likes RequestDispatcher vs Response.sendRedirect Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "RequestDispatcher vs Response.sendRedirect" Watch "RequestDispatcher vs Response.sendRedirect" New topic
Author

RequestDispatcher vs Response.sendRedirect

Nikita Dutt
Greenhorn

Joined: Dec 24, 2010
Posts: 20
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

Joined: Jan 18, 2011
Posts: 60

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

Joined: Jan 10, 2002
Posts: 60991
    
  65

No. You cannot forward outside of the current web app.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Joseph Mokenela
Ranch Hand

Joined: Jan 18, 2011
Posts: 60

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

Joined: Jan 10, 2002
Posts: 60991
    
  65

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

Joined: Dec 24, 2010
Posts: 20
Thanks to both of you
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: RequestDispatcher vs Response.sendRedirect