I need to validate the form which I have developed in Struts2. I need to validate it using Struts2. I am able to do simple validation using XML where my field name is something like
But when we have field as below,
Here user is our model object having different properties.
You could use like this.
mention here 1.0.2 dtd.
<validators>
<field name="firstName">
<field-validator type="requiredstring">
<message>Please enter the name</message>
</field-validator>
</field>
</validators>
I found the reason why our code doesn't work. When we use theme, into form, it doesn't display error messages if any. But when we don't use theme attribute into then it validate it and display error messages. We don't want to use default theme as it shows fields into thier table format. Is there any way to use validation with .