• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

httpservletrequest setParameter()?

 
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
reply
    Bookmark Topic Watch Topic
  • New Topic