Alex Rivera | Logout

How to set a parameter in a HttpServletRequest?

Asked 2009-05-21T11:47:11.553
39

I am using a javax.servlet.http.HttpServletRequest to implement a web application.

I have no problem to get the parameter of a request using the getParameter method. However I don't know how to set a parameter in my request.

Edit
Report

1 Answer

20

From your question, I think what you are trying to do is to store something (an object, a string...) to foward it then to another servlet, using RequestDispatcher(). To do this you don't need to set a paramater but an attribute using

void setAttribute(String name, Object o);

and then

Object getAttribute(String name);
answered 2009-05-21T11:53:34.507

Your Answer