Hi,
Small snippet from sun site :
"When a Servlet or JSP resource chooses to redirect the client (using a
response.sendRedirect(url)) the request object does not reach the second resource
directly since the underlying implementation is an HTTP redirect. The server sends an
HTTP
302 message back to the client telling it that the resource has moved to another URL,
and that
the client should access it there.
The bottom line is that the lifecycle of the initial request object that was accessed
in the
first JSP terminates with the end of the service method in the first JSP, or with the
reply from
the server. In a forward mechanism the request object is forwarded to the second
resource, thus
maintaining any object bindings to the request and its state, without a round trip to
the
client on the network."
HIH,
Rick
------------- Original Message --------------
Kyle Burke <[EMAIL PROTECTED]> wrote:
To:[EMAIL PROTECTED]
From:Kyle Burke <[EMAIL PROTECTED]>
Date:Wed, 28 Feb 2001 01:05:04 -0500
Subject: Re: fordward servlets
Sorry for the double post peeps.
When I asked:
>Do we even have access to
>'req' and 'res' the objects with "sendRedirect(URL)" or are they out of
>scope?
I meant:
Are the 'req' and 'res' forwarded or does the target Servlet get fresh
params?
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of Kyle
Burke
Sent: Wednesday, February 28, 2001 12:55 AM
To: [EMAIL PROTECTED]
Subject: Re: fordward servlets
Although this will work just fine, it is less elegant than Robert's solution
of "RequestDispatcher.forward(request,response)".
I have always used "response.sendRedirect(URL)" when some sort of error
occurs within the currently executing Servlet.
Can anyone shed some more light on this topic? Do we even have access to
'req' and 'res' the objects with "sendRedirect(URL)" or are they out of
scope? Suppose I'll test it.
-----Original Message-----
From: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]On Behalf Of
Fabrizio Gianneschi
Sent: Tuesday, February 27, 2001 7:13 AM
To: [EMAIL PROTECTED]
Subject: Re: fordward servlets
At 12.44 27/02/01 +0100, you wrote:
>Hi,
>
>It's possible to send the http response to another servlet directly from
>the code (without displaying any HTML page), for example, if a condition is
>true?
use response.sendRedirect(URL)
Bye
Fabrizio
___________________________________________________________________________
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
___________________________________________________________________________
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
_____________________________________________________
Chat with your friends as soon as they come online. Get Rediff Bol at
http://bol.rediff.com
___________________________________________________________________________
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