A RequestDispatcher is an object which is used to *forward* the request and
response objects to another servlet. And, according to the docs, "the request
and response parameters must be the same objects as were passed to the calling
servlet's service method". So, for example, within the doPost method of your
calling servlet, if you have a RequestDispatcher object, and you forward your
request using "requestDispatcher(req, resp);" to another servlet, you can say
req.getParameter(paramName) in your second servlet and get same value as you
would have in the first servlet. (You need to be careful about not having
committed your response already to the browser though..) But in the case of
response.sendRedirect(), you are simply redirecting control somewhere else;
your request and response objects of the first servlet are "lost"... Y (You can
of course "fake it" by passing in queryString vars. in the url of the
sendRedirect method, but that's another story..)

Hope this helps.
Geeta

"Srini Sathya." wrote:

> Can any1 shed some light on the title please.
>
> Obviously both of them is redirecting toa some URL right??.
>
> Thanks,
> Srini
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to