Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change the parameter value of Http Request

Status
Not open for further replies.

gunalan

Technical User
Jun 29, 2004
52
US
Hi,

I want to modify my request parameter before dispatching to a different servlet.it is possible?

Thank You.
 
String original = request.getParameter("original");
original = "some_new_value";

// send your new value to the servlet ....


Is this what you mean ?

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Hi,


I need to forward my request to another servlet.

The way you described will modify parameter value?

ActionType is my parameter...say it contains string value new...i want to update it to error string value.

pretty new to this ...hope i explained you clearly..

String ActionType = request.getParameter("ActionType");
// Looking for something where I can update my parameter
//ActionType...Basically I want to set to new value error.
RequestDispatcher rd =
request.getRequestDispatcher(
"/servlet/exampleServlet");
rd.forward(request,response)

Thank You.
 
Well you asked how to modify a request parameter ... which is just a String ...

String mynewparam = "hello";
RequestDispatcher rd = request.getRequestDispatcher("/servlet/exampleServlet?myparam=" +mynewparam);
rd.forward(request,response);

... would work ...

--------------------------------------------------
Free Java/J2EE Database Connection Pooling Software
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top