The code below works a treat but just to help anyone out who might be trying to do the same thing you can also use the tag <s:fielderror /> which does a similar thing but without the fine control on the formatting.

Quoting Greg Lindholm <greg.lindh...@gmail.com>:

So, fieldErrors is a Map<String, List<String>>, the key is the field name
and the value is a List<String> of messages.

I don't think you can use <s:iterator value="fieldErrors"> directly on a Map
as a Map is not iteratable (check the iterator tag doc [1]).

I think you will need to iterate on either the entry set <s:iterator
value="getFieldErrors().entrySet()"> or the key set <s:iterator
value="getFieldErrors().keySet()">.

As for %{top}, this gives you the top object on the value stack which inside
the <s:iterator > tag is the current object in the iteration, this is just
short-hand instead of using the var= attribute.

You could try something like this

<s:iterator value="getFieldErrors().entrySet()" var="entry">
     <s:iterator value="#entry.value">
           Field Name = <s:property value="#entry.key"/>
           Message = <s:property value="%{top}"/><br>
     </s:iterator>
</s:iterator>




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to