aspose file tools
The moose likes JSP and the fly likes pl. tell me diff. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply 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
 
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: pl. tell me diff.
 
Similar Threads
Java 1.2 & java 2
Diff Between EJB and WebService
reg. sendRedirect
what is difference between MVC1 & MVC2 pattern?
repaint and update