PDA

View Full Version : How to check errors for a form field?


java.public@gmail.com
Oct 11th, 2005, 04:46 AM
Hi,
I have a form with eg. 5 fields, one of the fields is required, I can show error message as:

<c:out value="${status.errorMessage}" />

but I wanted it nice formated (add div, img html tags), so I need to check if theere is an error first.
How can I do this? Is there any Spring tags, or I need to write a scriplet?
I found method hasFieldErrors(String field) but how can I get errors instance related for field it matches?

Best Regards,
Lee

Colin Yates
Oct 11th, 2005, 07:11 AM
<c:if test="${not empty status.errorMessages}">
</c:if>

carlos_santiago
Oct 12th, 2005, 08:19 PM
I use :


<spring:bind path="bean.name">
<td><input name="<c:out value="${status.expression}"/>"
value="<c:out value="${status.value}"/>" type="text" >
<FONT color="red" size="0"><c:out value="${status.errorMessage}"><FONT></spring:bind>
</td>