How can I add or remove parameters from a request instance, before sending it to the RequestDispatcher?

Alex Chaffee

As of Servlet spec 2.2, it's impossible to add or remove parameters from a request object. Servlet spec 2.3 will have some mechanism to allow this functionality. (How difficult it will be in practice is not clear. It will definitely not be as easy as 'request.removeParameter("foo")', unfortunately.)

In the meantime, using a wrapper class will work in some servlet engines but fail in others.

The mechanism in 2.3 is to use the "HttpServletRequestWrapper" class. See the JavaDoc API.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.