<field
name="model.userName">
<field-validator type="requiredstring">
<message>You
must enter a value
for username</message>
</field-validator>
</field>
BUT it's not a workaround at all,
because in your forms, input names are not "model.userName" but "userName", so
you can not match directly the FieldError from your input field.
Just to say
: it's a bug. If you want model driven validation works, the validation
framework must refer to the ValueStack not directly to the
action.
Cheers.
Richard.
-----Message d'origine-----
De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]De la part de Thompson, Kris
Envoy� : mardi 30 septembre 2003 22:46
� : Opensymphony-Webwork (E-mail)
Objet : [OS-webwork] Issue with ModelDriven Validation
I am having a problem with getting model driven validation. I am getting an OGNL exception stating that if can't get the value of my property as defined in the <ActionClassname>-validation.xml file. I remember reading about a bug in with this and model driven beans but not sure if it is related. Below is a segment of the excpetion
Sep 30, 2003 2:23:50 PM com.opensymphony.xwork.validator.validators.ValidatorSupport getFieldValue
SEVERE: Caught exception while getting value for field userName
ognl.NoSuchPropertyException: userName
at ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:123)
at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1219)
at ognl.ASTProperty.getValueBody(ASTProperty.java:108)
at ognl.SimpleNode.getValue(SimpleNode.java:129)
at ognl.Ognl.getValue(Ognl.java:335)
at ognl.Ognl.getValue(Ognl.java:310)
at com.opensymphony.xwork.validator.validators.ValidatorSupport.getFieldValue(ValidatorSupport.java:80)
at com.opensymphony.xwork.validator.validators.RequiredStringValidator.validate(RequiredStringValidator.java:23)
Here is a segment of the validation.xml file
<field name="userName">
<field-validator type="requiredstring">
<message>You must enter a value for username</message>
</field-validator>
</field>And I my model does have a getter and setter with the correct case.
And lastly here are there interceptors and the order of which they are called.
<interceptor-ref name="defaultStack"/>
<interceptor-ref name="component"/>
<interceptor-ref name="model-driven"/>
<interceptor-ref name="validation"/>
<interceptor-ref name="workflow"/>Any help?
Kris
