aspose file tools*
The moose likes Servlets and the fly likes Use of getRequestDispactcher() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Use of getRequestDispactcher()" Watch "Use of getRequestDispactcher()" New topic
Author

Use of getRequestDispactcher()

Dinesh Tahiliani
Ranch Hand

Joined: Aug 06, 2007
Posts: 486
Hello Ranchers,

What is use of getRequestDispactcher() in jsp, please explain with example?
What makes it differ from forward and redirect methods?



Thanks<br />Dinesh
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61222
    
  66

As Java code should never be put into JSPs, there is no use of RequestDispatcher in JSPs.

It is, however, used under-the-covers to perform includes and forwards. But as a JSP author, one does not need to worry about that.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Dinesh Tahiliani
Ranch Hand

Joined: Aug 06, 2007
Posts: 486
RequestDispatcher is in servlet , what is its use, please explain
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

It's what allows us to do includes and forwards. Redirects are done with the response.
Nishan Patel
Ranch Hand

Joined: Sep 07, 2008
Posts: 688


Hi,

Actually at servlet side RequestDispacher and sendRedirect use for forwarding your request just they use to forward methodology is difference....

1 ) Using request dispatcher you can for ward your request but without knowing your client so it happens at server side. So, you are not see that request in browser.

2 ) While send redirect also use for the same use but it happens at client side... and new request url see at clents browser windows.........




Thanks, Nishan Patel
SCJP 1.5, SCWCD 1.5, OCPJWSD Java Developer,My Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Use of getRequestDispactcher()