Spring boot 带有Mustach和spring错误标记的错误消息
我从Spring中找到了以下文档,可以轻松地验证表单。 现在我有一个问题,就是我不能将Thymeleaf错误标签与小胡子一起使用。有人有解决办法或想法吗 这是文档中的解决方案Spring boot 带有Mustach和spring错误标记的错误消息,spring-boot,validation,spring-mvc,tags,mustache,Spring Boot,Validation,Spring Mvc,Tags,Mustache,我从Spring中找到了以下文档,可以轻松地验证表单。 现在我有一个问题,就是我不能将Thymeleaf错误标签与小胡子一起使用。有人有解决办法或想法吗 这是文档中的解决方案 <html> <body> <form action="#" th:action="@{/}" th:object="${personForm}" method="post"> <table> &
<html>
<body>
<form action="#" th:action="@{/}" th:object="${personForm}" method="post">
<table>
<tr>
<td>Name:</td>
<td><input type="text" th:field="*{name}" /></td>
<td th:if="${#fields.hasErrors('name')}" th:errors="*{name}">Name Error</td>
</tr>
<tr>
<td>Age:</td>
<td><input type="text" th:field="*{age}" /></td>
<td th:if="${#fields.hasErrors('age')}" th:errors="*{age}">Age Error</td>
</tr>
<tr>
<td><button type="submit">Submit</button></td>
</tr>
</table>
</form>
</body>
</html>
姓名:
名称错误
年龄:
年龄误差
提交
我的edit.mustache文件的一部分
<form action="/event/save" enctype='multipart/form-data' method="post">
{{#event}}
<div class="form-row">
<div class="form-group col-md-6">
<label for="title">Name</label>
<input min="1" maxlength="60" type="text" class="form-control" id="title" name="title"
placeholder="Titel" required
value="{{title}}">
</div>
</div>
{{{#事件}
名称