0
这里是我的形式,输入字段电子邮件&密码Thymeleaf th:href获取其他输入字段值?
<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>
我弹簧启动控制器如下:
@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");
}
但是看起来不行,可以分享一下如何获得其他输入字段值,非常感谢!
是的,我也同意Slava Semushin ...电子邮件是一个机密问题,应该为任何外部获取请求进行加密,例如“取消订阅电子邮件”链接。即使你应该使用一个带有发布请求的表单,而不是获得方法@Tommy Yeh – Johir