I know that I can use HttpServletRequest.getParameter()
to get the URL parameter values.
Is there an equivalent method with which I can set/replace the value?
No, there is not.
You can only change attributes, not parameters.
The only way to achieve something similar would be to wrap the request (with a class that returns something else for getParameter).
Related curiosity: There is a bug in some servlet containers that would let you do request.getParameterValues(name)[0] = "newValue"
, but this can only lead to inconsistencies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With