For the example below, here's how to do it with html:messages instead:
<div class="error"> <ul> <html:messages id="msg"> <li><c:out value="${msg}" /></li> </html:messages> </ul> </div>
Despite the name, html:messages defaults to looking for ActionMessages saved using "saveErrors", not "saveMessages", although you can use the "messages='true'" attribute to change that, and you can use other attributes to look up an arbitrary ActionMessages saved under any key; you can also specify a "property" attribute to filter the list to only messages associated with a certain property.
As usual, see the docs for full details, but I prefer html:messages to html:errors for this very reason.
Joe
At 5:06 PM -0700 2/27/05, Wendy Smoak wrote:
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.
--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Narrow minds are weapons made for mass destruction" -The Ex
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]