【发布时间】:2017-01-16 17:37:18
【问题描述】:
这是我的表单,输入字段电子邮件和密码
<form class="form-signin" th:action="@{/login}" method="post">
<input type="email" name="email" id="inputEmail" class="form-control" placeholder="Email address" required="required" autofocus="autofocus" />
<input type="password" name="password" id="inputPassword" class="form-control" placeholder="Password" required="required" />
<button class="btn btn-lg btn-primary btn-block btn-signin" type="submit">Sign in</button>
</form>
我想试试 Thymeleaf th:href 发送带参数的 get 请求,
这是我的代码:
<a href="#" th:href="@{/user/forgot_password{email}(email=$(inputEmail).val())}" class="forgot-password"> Forgot the password? </a>
我的 Spring-Boot 控制器如下:
@RequestMapping(value = "/forgot_password", params = {"email!="}, method = RequestMethod.GET)
public @ResponseBody RespCommon forgotPassword(
@RequestParam(value = "email", required = true) String email) {
userService.forgotPassword(email);
return new RespCommon(ResultCode.SUCCESS, "Send forget password mail succeed");
}
但是好像不行,能不能分享一下如何获取其他输入字段的值,非常感谢!
【问题讨论】:
标签: spring-boot thymeleaf