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 ?
As far as I remember, you need to use <form:errors />
without path
attribute to do it.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With