[SPR-3390] Better error handling from the <form:errors> tag Created: 18/Apr/07  Updated: 15/Jan/19

Status: Open
Project: Spring Framework
Component/s: Web
Affects Version/s: 2.0.4
Fix Version/s: Waiting for Triage

Type: New Feature Priority: Major
Reporter: William Shields Assignee: Unassigned
Resolution: Unresolved Votes: 20
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
is duplicated by SPR-9221 Extend <form:errors> with something l... Resolved
Days since last comment: 1 year, 18 weeks, 6 days ago
Last commented by a User: true
Last updater: Spring Issuemaster


<form:errors> is a pretty crude mechanism for displaying multiple errors. It uses a default delimieter of <br>. It should allow for more sophisticated methods of displaying errors.

In the simple case, I would like to see "schemes" introduced. For example:

<form:errors path="*" scheme="ul"/>

which would craete:


Note: if there were no errors the enclosing <ul> tag should not be rendered.

Example schemes could be:


Potentially this may require another attribute to distinguish between the CSS class given to the enclosing tags and that given to each element, although if the enclosing tag got the value of cssClass, a CSS selector could resolve that problem without adding an attribute.

In the more complicated example, it is possibly worthwhile (although arguably unnecessary if you have sufficient schemes as defined above) to allow either the programmer to write their own schemes or to have sufficient attributes to achieve the same thing.


<form:scheme name="errorTable">

<th>Error #</th>
<th>Error Description</th>

<form:loop var="count">
<td><c:out value="${count}"/></td>



The simple example of this kind of thing would be adding attributes:

<form:errors path="*" block="ul" item="li"/>

alternatively have a heading block within:

<form:errors path="*" block="ul" item="li">
<p>The following errors have occurred:</p>

Anywa, you get the idea.

Comment by Rick Evans [ 10/Jul/07 ]

(For my own reference.)


Comment by Rick Evans [ 10/Jul/07 ]

Hi William

I agree that <form:errors/> is a pretty coarse mechanism for displaying errors. The delimiter between individual errors can now be controlled (see the Javadoc), but it is nowhere near as flexible as you'd like.

I am not going to have enough time to address this myself in the 2.1 timeframe though. I'm going to have to let this one slip to a later release... I guess it needs to accrue more votes before it becomes a priority.


Comment by Spring Issuemaster [ 14/Jan/19 ]

The Spring Framework has migrated to GitHub Issues. Please visit spring-projects/spring-framework#8073 for further activity, or to subscribe to receive notifications.

Generated at Mon May 25 01:58:41 UTC 2020 using Jira 8.5.4#805004-sha1:0444eab799707f9ad7b248d69f858774aadfd250.