• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Can anybody tell me the difference between sendRedirect & RequestDispatcher object?

 
Ranch Hand
Posts: 339
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi to all
Can anybody tell me the difference between sendRedirect & RequestDispatcher object? Please make me understand by using a suitable example.
 
Ranch Hand
Posts: 10198
3
Mac PPC Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Redirect - Makes the browser do another request on behalf of you.

RequestDispatcher - The server does the redirect.

If you see the difference, with your redirect, it's all together like making a new request which means, your request param values that you had before the redirect happened is lost and all together a new one is generated once the redirect happens. Hope you get the difference between them.
 
Ranch Hand
Posts: 115
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1) sendRedirect --> The server will send to the browser the new url. The browser will follow this url. You can see the change of URL in the browser address bar. Means , the client handles the redirection.

2) RequestDispatcher --> The server will transfer the request to another web component on the server side. There will not be change in url in the browser(client side). Means, the server handles the redirection.
 
reply
    Bookmark Topic Watch Topic
  • New Topic