春季启动百里角thymeaf表格邮政数据比JSON数据
我的问题是,我的胸腺模板用于重置密码,我想要密码帖子,而不是JSON数据(实际帖子而不是表单数据)到我的Spring Boot服务器。我该怎么做?
我的休息控制器:
@PostMapping(value = "/save-new-password")
public String saveStudent(@Valid @RequestBody NewPasswordDTO newPasswordDTO) {
return "OK";
}
来自我的repet-password-page.html的一部分:
<body>
<form th:action="@{/save-new-password}" th:object="${newPasswordDTO}" method="post">
<div class="box">
<h1>RESET PASSWORD</h1>
<input class="password" name="newPassword" type="password" placeholder="New password" th:field="*{newPassword}">
<input class="password" name="confirmPassword" type="password" placeholder="Confirm password" th:field="*{confirmPassword}">
<input class="button" type="submit" value="RESET"/>
</div>
</form>
</body>
My problem is I have thymeleaf template for reset password and I want passwords post than json data (actualy post than form data) to my spring boot server. How can I do it?
My rest controller:
@PostMapping(value = "/save-new-password")
public String saveStudent(@Valid @RequestBody NewPasswordDTO newPasswordDTO) {
return "OK";
}
Part from my reset-password-page.html:
<body>
<form th:action="@{/save-new-password}" th:object="${newPasswordDTO}" method="post">
<div class="box">
<h1>RESET PASSWORD</h1>
<input class="password" name="newPassword" type="password" placeholder="New password" th:field="*{newPassword}">
<input class="password" name="confirmPassword" type="password" placeholder="Confirm password" th:field="*{confirmPassword}">
<input class="button" type="submit" value="RESET"/>
</div>
</form>
</body>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论