Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot 带有Mustach和spring错误标记的错误消息_Spring Boot_Validation_Spring Mvc_Tags_Mustache - Fatal编程技术网

Spring boot 带有Mustach和spring错误标记的错误消息

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> &

我从Spring中找到了以下文档,可以轻松地验证表单。 现在我有一个问题,就是我不能将Thymeleaf错误标签与小胡子一起使用。有人有解决办法或想法吗

这是文档中的解决方案

<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>

{{{#事件}
名称