Spring 我正试图找到最好的方式来显示一个错误框中的错误弹簧
我正试图找到最好的方式来显示一个错误框中的错误弹簧 我喜欢在每个相关字段下显示该错误。下面是我的代码,但我想换个方式会更容易些Spring 我正试图找到最好的方式来显示一个错误框中的错误弹簧,spring,jsp,spring-mvc,Spring,Jsp,Spring Mvc,我正试图找到最好的方式来显示一个错误框中的错误弹簧 我喜欢在每个相关字段下显示该错误。下面是我的代码,但我想换个方式会更容易些 <c:set var="validationErrorsContent"><form:errors path="content"/></c:set> <c:if test="${not empty validationErrorsContent}"> <font color="red"> <div
<c:set var="validationErrorsContent"><form:errors path="content"/></c:set>
<c:if test="${not empty validationErrorsContent}">
<font color="red">
<div id="error" class="error">
<form:errors path="content" cssClass="error" />
</div>
</font>
</c:if>
您可以使用
<form:errors path="*"/>
如果您还应用了自定义验证,那么您可以像这样在jsp页面上应用它
<c:if test="${success=='n'}">
<form:errors path="*"/>
</c:if>
并在您的控制器上为
map.put(“success”,“n”)设置“success”代码>问题在于错误不会按屏幕上字段的顺序显示