Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

diff between redirect and requestdispatcher

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what is the difference between redirect and requestdispatcher
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They both are likely the same, But when you use request dispacher, web-server is responsible for redirecting the request i.e client side. Whereas redirect, it is from the server side. So browser assumes it is at the same URL.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
satsranchuser,

On your way in you may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.

They both are likely the same, But when you use request dispacher, web-server is responsible for redirecting the request i.e client side. Whereas redirect, it is from the server side. So browser assumes it is at the same URL.



I think you have that exactly the wrong way around.

The two concepts are not the same at all. A request dispatcher forwards the request *on the server* to a different resource; the URL visible in the browser stays the same.

A redirect means sending a response back to the browser which asks it to retrieve a different URL instead of the original one; this will change the URL visible in the browser. A redirect can go to a different server, which is not possible with request dispatching.
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So, do anybody know how to requestDistpatcher to a JSP, showing the JSP url, not the servlet one?

Thanks in advance!
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

do anybody know how to requestDistpatcher to a JSP, showing the JSP url, not the servlet one?



That's not possible.

Also, you may have missed that we have a policy on screen names here at JavaRanch. Basically, it must consist of a first name, a space, and a last name, and not be obviously fictitious. Since yours does not conform with it, please take a moment to change it, which you can do right here.
 
reply
    Bookmark Topic Watch Topic
  • New Topic