I have a JSP that uses an tag with a hidden value to pass to the doGet in a servlet and so far this works well. However, can I change the hidden value dynamically? Currently it is
<input type="hidden" name="command" value="COMMAND1" />
but I want the COMMAND1 to be one of two commands. I tried changing the line above to this;
<input type="hidden" name="command" value="<%=request.getParameter
("USE_COMMAND") %>" >
Then the doGet in the servlet calls the procedure below and I tried setting the command as shown here but it doesn't work. Can this be done?
private void processCommand(HttpServletRequest request, HttpServletResponse
response) throws Exception {
....
// dynamically set hidden command for JSP form GET
String useCommand = "COMMAND2";
request.setAttribute("USE_COMMAND", useCommand);
....
// send to JSP page (view)
RequestDispatcher dispatcher = request.getRequestDispatcher
("/theJSPPage.jsp");
dispatcher.forward(request, response);
}