I encountered a problem with clearing and resetting the parameters of the
HttpServletRequest Object.
The story started with the forwarding some request to an JSP from a servlet
and then getting the information of that jsp form to the same servlet,
testing them and then forwarding to another JSP
But it makes an exception of "IllegalStateException" with this message:
Error in clearRequestParameters: Cannot find message associated with key
'parameterMap.locked'
As a matter of fact I used the front controller pattern and previously I
used the
public void doProcess(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
...
req.getRequestDispatcher(getContractName(req)).forward(req, resp);
}
At that time I didn't have any problem with this method before calling
forward within a servlet!
protected void clearRequestParameters(HttpServletRequest req) {
try {
req.getParameterMap().clear();
} catch (Exception ex) {
System.out.println("Error in clearRequestParameters: " +
ex.getMessage());
}
}
But as I changed the above mentioned expression to this (for providing no
point access to other servlets than Front Controller):
public void doProcess(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
...
getServletContext().getNamedDispatcher(getContractName(req)).forward(req,
resp);
}
The problem began!
Please said to me what is the problem, I created also a servlet name entry
in web.xml for the only JSP page which called to make composite view and it
works well as actually all thing goes well but sometimes the above error
displayed and the parameters which are necessary to other pages and make
them mistakenly can not be removed!
I should tell you that I use Tomcat 4.1.24 as Web Server!