aspose file tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes diff between redirect and requestdispatcher Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Reply Bookmark "diff between redirect and requestdispatcher" Watch "diff between redirect and requestdispatcher" New topic
Author

diff between redirect and requestdispatcher

ganta satya gopal
Greenhorn

Joined: May 10, 2007
Posts: 2
what is the difference between redirect and requestdispatcher
sathish kumar
Ranch Hand

Joined: Feb 14, 2007
Posts: 47
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.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35223
    
    7
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.


Android appsImageJ pluginsJava web charts
Zotal warlord
Greenhorn

Joined: Jun 01, 2007
Posts: 2
So, do anybody know how to requestDistpatcher to a JSP, showing the JSP url, not the servlet one?

Thanks in advance!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 35223
    
    7
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.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: diff between redirect and requestdispatcher
 
Similar Threads
What is difference between RequestDispatcher() and sendRedirect()?
Can anybody tell me the difference between sendRedirect & RequestDispatcher object?
SendRedirect Vs RequestDispatcher
Request Dispatching
difference between RequestDispatcher from a ServletRequest and from a ServletContex