PDA

View Full Version : display associated field error beside field


arden
May 2nd, 2008, 12:36 PM
Hi,
I have the following code, which will display all field error.
If I want to display associated field error beside field, do you know how to do this?
Thanks a lot.

<spring:hasBindErrors name="addAlbumCommand">
<c:forEach items="${errors.fieldErrors}" var="error">
<spring:message code="${error.code}" text="${error.defaultMessage}"/><br/>
</c:forEach>
</spring:hasBindErrors>
<form action="<c:url value='/addalbum.spring'/>" method="post">
<table>
<tr>
<td><fmt:message key="album.add.name"/></td>
<td><input type="text" id="name" name="name" size="30" maxlength="100"/></td>
</tr>
<tr>
<td><fmt:message key="album.add.description"/></td>
<td><textarea cols="30" rows="5" name="description"></textarea></td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="submit" value="<fmt:message key="common.submit"/>"/>
<input type="reset" value="<fmt:message key="common.reset"/>"/>
</td>
</tr>
</table>
</form>

rjuyal
May 5th, 2008, 06:53 AM
<spring-form:errors path="yourvariableInDataBind" />