Sushil Singh wrote:
>
> Hi,
>
> I am having a typical requirement- one JSP recieves form data,
> before passing control to another servlet, I just want to add new
> parameter to the request.
>         reponse.sendRedirect(request, response);
>
> Is it possible to change the parameters or add new parameters before
> redirecting to another servlet using sendRirect().

The sendRedirect() method signature you show above doesn't exist in
the API; it's sendRedirect(String newLocation). A redirect asks the
browser to make a new request using the new location (URL). You
can use a regular query string to pass on parameters to the new URL:

  sendRedirect("myServlet?foo=bar");

But you may actually want to use a forward instead of a redirect here.
A forward is an internal server call, so it's faster. In a JSP page
you can forward to a servlet and add new parameters like this:

  <jsp:forward page="myServlet">
    <jsp:param name="foo" value="bar" />
  </jsp:forward>

Hans
--
Hans Bergsten           [EMAIL PROTECTED]
Gefion Software         http://www.gefionsoftware.com

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to