Reputation: 5314
In my form, i have some specific targeted errors (with path="myField"
) and i'd like to throw global errors, because they span multiple fields.
But if i use <form:errors path="*">
, it will print global AND re-print local errors !
How can i print only the global ones ?
Upvotes: 9
Views: 10057
Reputation: 11
omitting path does not work, you must insert empty path:
<form:errors path=""/>
Upvotes: 0
Reputation: 242786
As far as I remember, you need to use <form:errors />
without path
attribute to do it.
Upvotes: 11
Reputation: 17492
I am not sure about using form
tag to do that. But Errors
object has methods to getglobalerrors.
EDIT
<spring:hasBindErrors name="input">
<c:forEach items="${errors.globalErrors}" var="errorMessage">
<div id="errors" class="errors">
<c:out value="${errorMessage.defaultMessage}" />
</div>
</c:forEach>
</spring:hasBindErrors>
Upvotes: 5