Use the RequestDispatcher!

Response.sendRedirect sends a HTTP response with a location Header
back to the Browser an the Browser will follow the location Header.
Result of this: the request and response objects of the 'original'
request get lost!

Instead Response.sendRedirect(..);
use
getServletContext().getRequestDispatcher("/servlet/anyServlet").forward(requ
est,response)

This command forwards the 'original' request to the selcted servlet.


Greetings Alex

 +-----------------+
 | Alexander Meyer |
 +-----------------+--------------------------------+
 | Sponackerweg 54                                  |
 | 63808 Haibach                                    |
 |                                                  |
 | Tel. 0 60 21 / 61 05 35                          |
 | E-Mail [EMAIL PROTECTED]                        |
 | Homepage http://www.alexmeyer.org                |
 |                                                  |
 | Zertifikate:                                     |
 | Brainbench Certified Master Java Server Pages    |
 | (JSP 1.1) Developer                              |
 | Brainbench Certified Master PHP 4 Developer      |
 | Brainbench Certified Master JavaScript Developer |
 | Brainbench Certified Master HTML 3.2 Developer   |
 | Brainbench Certified Java 2 Developer            |
 | Brainbench Certified XML Developer               |
 | Brainbench Certified HTML 4 Developer            |
 | Brainbench Certified WWW Concepts Architect      |
 +--------------------------------------------------+


> -----Ursprüngliche Nachricht-----
> Von: A mailing list for discussion about Sun Microsystem's Java Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]Im Auftrag von
> Alfredo Solano Martinez
> Gesendet: Donnerstag, 8. März 2001 21:33
> An: [EMAIL PROTECTED]
> Betreff: Response.sendRedirect() vs RequestDispatcher.forward
>
>
> Greetings,
>
>     I have a servlet that gets a request, and after processinf a
> bit of it,
> I want it to let another servlet do the rest of the work. Which
> one of those
> two ways is better?
>
> Thanks
>
> __________________________________________________________________
> _________
> 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