フォームの外にフォームエラーを表示するにはどうすればよいですか。を使用してフォーム内に表示できることを知っています<sf:errors path="nb"></sf:errors>
。別々に表示したい場合はdiv
どうすればよいですか?春は初めてですので、ご案内ください。
3066 次
1 に答える
6
すべてのエラーメッセージを同時に表示する場合は、次のtaglibを使用できます。
<%@taglib uri="http://www.springframework.org/tags" prefix="spring" %>
何かのようなもの、
<spring:hasBindErrors htmlEscape="true" name="someBean">
<c:if test="${errors.errorCount gt 0}">
<h4>The error list :</h4>
<font color="red">
<c:forEach items="${errors.allErrors}" var="error">
<spring:message code="${error.code}"
arguments="${error.arguments}"
text="${error.defaultMessage}"/><br/>
</c:forEach>
</font>
</c:if>
</spring:hasBindErrors>
name="someBean"
タグのname属性は、<spring:hasBindErrors/>
フォームにバインドされている実際のコマンドオブジェクトであることに注意してください。
于 2013-02-14T10:17:16.213 に答える