views:

315

answers:

1

When using Struts2 validation, when you put the <s:actionerror> tag in your JSP, the default behavior is to display all the action errors at that point in the page.

Is there a way to display only specific error messages at that point? For example, in the case of fielderror one only needs to add the fieldName attribute. Is there an attribute of actionerror that accomplishes similar behavior?

+1  A: 

You can use the following test :

For field specific error the function is : "hasFieldErrors()"

Taken from : http://struts.apache.org/2.0.6/struts2-core/apidocs/com/opensymphony/xwork2/ValidationAware.html

ruffp
I'll upvote your contribution. I'll not accept, because I'm not in a position to determine if this provides what I need. The project is finished, and I work for a different company.
FarmBoy