servlets thread: Changing parameters while using RequestDispatcher...
otherwise it is better to use the following which will keep a hold of the
query string that was passed to the original servlet and add your value. It
is is also the standard way to do it.
try
request.setAttribute("nameofattribute", valueofattribute);
RequestDispatcher requestDispatcher =
getServletContext).getRequestDispatcher("URL to your servlet");
requestDispatcher.forward(request, response);
this is not really all the code but should give you an idea of what you need
to do. Basically, you are first adding the name and value for the parameters
you want to pass. You then get an object called a request dispatcher that
knows how to move the request and response to the servlet or jsp file that
you pass it. You then can forward the request to the servlet in which case
it takes over responsiblity for returning content to the client or you can
include the content that the servlet creates in the content that the first
servlet generates.
chanoch
chanoch
-----Original Message-----
From: mohamed anez [mailto:mohamedanez@h...]
Sent: 31 August 2001 20:55
To: Servlets
Subject: [servlets] Re: Changing parameters while using
RequestDispatcher...
Hi,
Its possible .
response.sendredirect(targeturl &value=pair&value=pair)
Try it it will work it out.
Best of Luck
(A.Mohamed Anez)
>From: "Balachandar" <zenithbala@h...>
>Reply-To: "Servlets" <servlets@p...>
>To: "Servlets" <servlets@p...>
>Subject: [servlets] Changing parameters while using RequestDispatcher...
>Date: Fri, 31 Aug 2001 15:15:05
>
>hi
>When a Request is dispatched from One Servlet to another servlet, i would
>like to add some more "name=value" or make some changes in the existing
>parameters, that are in the request. Is that possible?
>
>bala