tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Berry, Layton" <>
Subject RE: Forwarding with parameters
Date Thu, 24 Jul 2003 16:43:18 GMT
Using forward changes control within the server, while sendRedirect
transfers control to the browser and asks it to make another request.  Hence
forward is faster, but the browser won't know what you did, and won't know
about any directory location changes.  This also means that a change from
http to https in a forward would be pointless since it does not involve
communication with the client.

As for setting parameters with a forward, you're on the right track.  Adding
them to your target string works for me.


-----Original Message-----
From: Shapira, Yoav []
Sent: Thursday, July 24, 2003 6:23 AM
To: Tomcat Users List
Subject: RE: Forwarding with parameters

Yup, use sendRedirect.

Or add a filter with a servlet request wrapper mapped to index.jsp that
checks and adds parameters as needed.

Yoav Shapira
Millennium ChemInformatics

>-----Original Message-----
>From: René Vangsgaard ML []
>Sent: Thursday, July 24, 2003 8:34 AM
>To: 'Gil Hauer '; 'Tomcat Users List '
>Subject: RE: Forwarding with parameters
>You cannot change protocol inside a reuqest. To change protocol you have to
>send a redirect to the browser.
>-----Original Message-----
>From: Gil Hauer
>To: Tomcat Users List
>Sent: 24-07-03 13:44
>Subject: Forwarding with parameters
>I have code in a servlet that, based on transaction status, forwards to
>another target page. The code snippet is:
>        String target = "/index.jsp";
>        ServletContext c = getServletContext();
>        RequestDispatcher d = c.getRequestDispatcher(target);
>        response.setContentType("text/html");
>        d.forward(request, response);
>How can I set new parameters for the target page? Is it as simple as
>	String target = "/index.jsp?param=val";
>I ask this since it doesn't seem to work -- that parameter does not seem
>to get set.
>Also, at this point I'm in an https session and I'd like to transfer to
>unencrypted protocol -- how can I do that?
>Thanks in advance,
>To unsubscribe, e-mail:
>For additional commands, e-mail:
>To unsubscribe, e-mail:
>For additional commands, e-mail:

This e-mail, including any attachments, is a confidential business
communication, and may contain information that is confidential, proprietary
and/or privileged.  This e-mail is intended only for the individual(s) to
whom it is addressed, and may not be saved, copied, printed, disclosed or
used by anyone else.  If you are not the(an) intended recipient, please
immediately delete this e-mail from your computer system and notify the
sender.  Thank you.

To unsubscribe, e-mail:
For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message