You can do the same thing as you do in the JSP.. 
once you've got your RequestDispatcher you can add some params to the URL as
query string parameters.  They will be entered into the the request as
normal request params.

ie:

in your doGet or doPost method


String url = "/some.jsp?att1=val1&att2=val2"
RequestDispatcher disp = getServletContext().getRequestDispatcher(url);
//or RequestDispatcher disp = request.getRequestDispatcher(url) 
disp.forward(request, response)


att1 and att2 will be available as

request.getParameter("att1");
request.getParameter("att2");

Does that answer your question?

cheers

Tref Gare


> -----Original Message-----
> From: Luis Javier Beltr�n [SMTP:[EMAIL PROTECTED]]
> Sent: Friday,2 August 2002 3:59
> To:   [EMAIL PROTECTED]
> Subject:      Adding parameters when forwarding
> 
> Hi everybody,
> 
> Is there any way to add parameters to a request for a servlet? I think
> this
> can be done using forward and param tags in JSPs, but is there any
> equivalent in servlets?
> 
> Thanks a lot!
> 
> Luis Javier
> 
> ==========================================================================
> =
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
> JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
> DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
> 
>  http://archives.java.sun.com/jsp-interest.html
>  http://java.sun.com/products/jsp/faq.html
>  http://www.esperanto.org.nz/jsp/jspfaq.jsp
>  http://www.jguru.com/faq/index.jsp
>  http://www.jspinsider.com

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

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to