File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use of getRequestDispactcher()

 
Dinesh Tahiliani
Ranch Hand
Posts: 486
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,

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

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Dinesh Tahiliani
Ranch Hand
Posts: 486
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RequestDispatcher is in servlet , what is its use, please explain
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's what allows us to do includes and forwards. Redirects are done with the response.
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.........



  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic