Hi Everyone,
I am trying to do validations using
struts framework.
I have the validation.xml,validator-rules.xml in place.
Also I have the ApplicationResources.properties file in the/WEB-INF/classes folder.
I have configured the above in the struts-config.xml :
<message-resources null="false" parameter="/WEB-INF/classes/ApplicationResources.properties" >
</message-resources>
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames" value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>
In ApplicationResources.properties I have :
errors.name.required=Name cannot be blank. Please enter a Name.
In validation.xml I have :
<form name="MyForm">
<field property="name"
depends="required">
<msg
name="required"
key="errors.name.required"/>
<arg0 key="errors.name.required"/>
</field>
</form>
My Form extends the org.apache.struts.validator.ValidatorForm.
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request){
ActionErrors errors = super.validate(mapping, request);
return errors;
}
Alsoin the struts-config.xml
I have
validate="true" input=/WEB-INF/jsp/a.jsp"
When I submit my page I see
???en_US.errors.name.required???
I checked all the spellings. eveything seems correct.
Also the ActionErrors gets populated with the correct key ie errors.name.required, but its value is ???..errors.name.required???
Can anyone please tell me a solution for this .
Thanks,
Gayatri