我正在使用 Spring MVC。如何在我的 Controller 方法中获取以下代码段的文本框值?
<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>
最佳答案
您可以像这样使用 @RequestParam
:
@RequestMapping(value="/forgotpassword", method=RequestMethod.POST)
public String recoverPass(@RequestParam("j_username") String username) {
//do smthin
}
关于spring - 如何在 Controller 中获取表单值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7524629/