wood burning stoves 2.0*
The moose likes JSP and the fly likes pl. tell me diff. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "pl. tell me diff." Watch "pl. tell me diff." New topic
Author

pl. tell me diff.

Kapil Keskar
Ranch Hand

Joined: Dec 04, 2001
Posts: 47
Hello,
Can any body tell me the difference between RequestDispatcher.forward() & response.sendRedirect() ?
What is the diff. ?
I think it is the difference between request time & response time redirection. is it correct?
Or else tell me the right?
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
Kapil
In the RequestDispatcher.forward method the returned content from the resourse forwarded to is returned as if it were from the orginally requested resource. Meaning it is invisible to the browser. The address in the address bar remains that of the orginally requested resourse.
In a redirect the browser is told to request a different resource and its address bar changes to reflect that.
you can tell the difference by looking at the methods. In the forward method it takes as its parameters the request and repsonse objects because new ones aren't created. In the redirect method the browser makes a new request so the original ones aren't needed.
hope that helps


Dave
 
wood burning stoves
 
subject: pl. tell me diff.
 
Similar Threads
what is difference between MVC1 & MVC2 pattern?
Diff Between EJB and WebService
repaint and update
Java 1.2 & java 2
reg. sendRedirect