Last I checked, Struts came configured to do what I think you are asking by default.

This is an example of the (Struts 1.1) ApplicationResources.properties file:

#header and footer for form validation error messages
errors.header=<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr align="left"><td><strong><font color="red">input error</font></strong></td></tr><tr><td>&nbsp;</td></tr><tr align="left"><td>Please resubmit the form after correcting your input to meet the following requirement(s):<ul>
errors.footer=</ul></td></tr><tr><td>&nbsp;</td></tr></table>



#form validation error messages #(rendered between header and footer above) errors.required=<li>{0} is required.</li> errors.minlength=<li>{0} cannot contain fewer than {1} characters.</li> errors.maxlength=<li>{0} cannot contain more than {2} characters.</li> errors.invalid=<li>{0} is invalid.</li> errors.byte=<li>{0} must be an byte.</li> errors.short=<li>{0} must be an short.</li> errors.integer=<li>{0} must be an integer.</li> errors.long=<li>{0} must be an long.</li> errors.float=<li>{0} must be an float.</li> errors.double=<li>{0} must be an double.</li> errors.date=<li>{0} is not a date.</li> errors.range=<li>{0} is not in the range {1} through {2}.</li> errors.creditcard=<li>{0} is not a valid credit card number.</li> errors.email=<li>{0} is invalid.</li> #user plugins errors.twofields=<li>{0} must have the same value as {1}.</li> errors.dateRange=<li>{0} is not an acceptable date.</li>


Then a simple <html:errors/> results in the bulleted list of all current validation errors, assuming your validation.xml is set up properly so that errors are matched with the messages in the properties file.


Hope this helps.

Erik



Adam Jenkins wrote:

Hi All,

Is there a simple way to iterate over all the validation errors.  I
don't want to just do <html:errors..../>  I want to actually for a
<ul><li>...</li></ul> of all the errors that occured when submitting the
page.

Is this possible?  Does anyone have an example I could use?

Cheers
Adam


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to