I have a question for any Servlet experts. getParameter("fieldName") gets the value of the fieldName input from the form. How can I change fieldName Parameter to new value, and return to the same jsp form. ex. 1. <input type=text name=fieldName value="hello"> 2. when submitted, will execute a servlet that changes fieldName to new value ("You again"). This servlet does not create any HTML. It will forward to pervious form. the previous form (JSP) will display the new value. 3. returns to the same form, but displays the new value.
1. If the getParameter("fieldName")is not null, you then redirect back to the same jsp page with a parameter named, for example, "resetFieldName" and value as "You Again". 2.In jsp page, you need to put extra code to get "resetFieldName" parameter, and then judge the value of that parameter, if the value is null, display <input type=text name=fieldName value="hello">,else display the value acquired from that parameter. I think you can use getAttribute ("resetFieldName"), then cast it into String for "resetFieldName" parameter. I have not touched Servlet for ages, so I could be wrong. But it worths trying. Hope that helps. Good luck.
Kick Welcome to the Java Ranch, we hope you�ll enjoy visiting as a regular however, your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy. Thanks again and we hope to see you around the ranch!! As for your question: as far as I know you can't change a RequestParameter once it has been sent to the container. The only thing you could do would be to set a Session variable or a RequestAttribute.