It's not a secret anymore!
The moose likes Servlets and the fly likes Adding a new Parameter to request Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Adding a new Parameter to request" Watch "Adding a new Parameter to request" New topic

Adding a new Parameter to request

Chhaya Dhanani
Ranch Hand

Joined: Apr 11, 2001
Posts: 70
i am unable to find a decent approach for this problem.
i want to add a new paramter to my request and pass it to a class.. not a servlet.
how do i do it?
Please help me sought this problem immediately..
Kiran Kumar
Ranch Hand

Joined: May 18, 2001
Posts: 107
a class cannot get the HttpRequest object directly. it has to be passed from the servlet. so if u want to send some object to the class use the request.setAttribute() and then pass it to the class

Thanks<br /> <br />Kiran <br /> <br />SCEA, SCJP 1.4,<br /> <br />"First they ignore u, then they laugh at u, then they fight u, <br />then u will win<br /> <br />Mahatma Gandhi"
Al Green

Joined: Feb 09, 2002
Posts: 10
In Servlet2.2 the only way to mutate the HttpRequest is to use the setAttribute method.
However, in Servlet2.3, you can use the HttpServletRequestWrapper (I believe thats the correct class name) to wrap the request which allows you to basically mutate (lie) about the http request.
I agree. Here's the link:
subject: Adding a new Parameter to request
It's not a secret anymore!