There's one improvement on that method:

errors.prefix=<li>
errors.suffix=</li>

So you don't need to put the markup into each error definition in your
properties file.

If you don't want markup in it at all, you can do something like

<logic:messagesPresent> 
<UL>
 <html:messages id="error"> 
 <LI><bean:write name="error"/></LI>
 </html:messages> 
</UL> 
</logic:messagesPresent>

Ted has a good page on this:

http://husted.com/struts/tips/017.html

-----Original Message-----
From: Wendy Smoak [mailto:[EMAIL PROTECTED] 
Sent: Sunday, February 27, 2005 7:06 PM
To: Struts Users Mailing List
Subject: Re: Iterate over validation errors?

From: "Adam Jenkins" <[EMAIL PROTECTED]>
> 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?

Do you _really_ want to iterate over the validation errors, or do you just 
want the output to be a bulleted list?  If all you want is the <ul><li> tags

around your errors, this works:

ApplicationResources.properties:
   errors.integer=<li>{0} must be an integer.</li>
   error.no.userId=<li>User ID does not exist</li>
   error.no.email=<li>No email address on file</li>
   errors.header=<ul>
   errors.footer=</ul>

somePage.jsp:
   <div class="error">  <html-el:errors/>  </div>
(The 'error' style just sets the font and turns it red, it's not required.)

I'm interested to know if there's a better way to do this-- putting markup 
in the .properties file doesn't seem "right" to me.

HTH,
Wendy Smoak







---------------------------------------------------------------------
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