Issue
I am using Spring MVC. How can I get text box value of the following snippet in my controller method?
<form name="forgotpassord" action="forgotpassword" method="POST" >
<ul>
<li><label>User:</label> <input type='text' name='j_username' /></li>
<li><label> </label> <input type="submit" value="OK" class="btn"></li>
</ul>
</form>
Solution
You can use @RequestParam
like this:
@RequestMapping(value="/forgotpassword", method=RequestMethod.POST)
public String recoverPass(@RequestParam("j_username") String username) {
//do smthin
}
Answered By - Jaanus
Answer Checked By - Marilyn (JavaFixing Volunteer)