*
The moose likes Servlets and the fly likes httpservletrequest setParameter()? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "httpservletrequest setParameter()?" Watch "httpservletrequest setParameter()?" New topic
Author

httpservletrequest setParameter()?

Edward Chen
Ranch Hand

Joined: Dec 23, 2003
Posts: 798
I have a html form using post method. the url looks like
localhost/job.do?myquery=4_5
I want to change to
localhost/job.do?myqueryString=4&myqueryString=5

I want to do it this in the server side. I want to do a filter, if server finds the "myquery", then split string, add it back to URL , then forward.

Now, the problem is, we don't have options to control parameter, for example, setParameter().

How to solve it?

Thanks
Carl Trusiak
Sheriff

Joined: Jun 13, 2000
Posts: 3340
In your filter create an HttpServletRequestWrapper

In your wrapper have most methods simply delegate to the wrapped request, add the method addParameter, and override the getParameter type methods as necessary to correctly give values back. Then when you call the doFilter method, pass the wrapper instead of the original request.


I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: httpservletrequest setParameter()?
 
Similar Threads
Redirect jsp pages
Microsoft Access Store Query
connecting to db - Oracle vs MS SQL
Hello guys here is an interesting problem?
Tomcat intranet Web Application