Vijay,
Thanks for your answer.
I tried what you suggested, with no success. I get an exception saying
that the getter method is not found :
java.lang.NoSuchMethodException: Property 'parameter' has no getter
method
at
org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(PropertyUtils.java:1180)
at
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:772)
at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
at
org.apache.commons.validator.Validator.validateField(Validator.java:487)
at org.apache.commons.validator.Validator.validate(Validator.java:582)
at
org.apache.struts.validator.ValidatorActionForm.validate(ValidatorActionForm.java:121)
at
com.rubis.web.system.action.SubmitStrategyAction.save(SubmitStrategyAction.java:71)
Here are the getter/setter methods of the form :
private LinkedList parameters;
public LinkedList getParameters() {
return parameters;
}
public void setParameters(LinkedList parameters) {
this.parameters = parameters;
}
public ParamInterfaceElementBean getParameter(int index) {
while( index >= parameters.size() ){
parameters.add(new ParamInterfaceElementBean());
}
return (ParamInterfaceElementBean) parameters.get(index);
}
public void setParameter(int index, ParamInterfaceElementBean parameter)
{
while ( index >= parameters.size() ){
parameters.add(new ParamInterfaceElementBean());
}
parameters.set(index, parameter);
}
Do you have a clue about what I'm doing wirng ?
Fred
Le lun 03/11/2003 Ã 13:25, Vijaykumar a Ãcrit :
> Hi Frederic,
>
> I thing in validation.xml u must provide your setting as
>
> property="orderNumber"
> indexedListProperty="parameter"
> depends="required,integer,positive">
>
>
>
> You have specified it as
> indexedListProperty="parameters"
>
> Plz Verify your validation.xml.
>
> -Vijay
>
>
> Frederic Dernbach wrote:
>
> >I would like to know how to use the Struts Validator with indexed
> >properties.
> >
> >I cannot display error messages under the field (but the validator
> >obviously works and performs validation).
> >
> >Below is the relevant parts of my JSP and of my valdiation.xml file :
> >Upon submission of the JSP's form, I can see the validator does not
> >validate the 'orderNumber' property if it is empty. But no error
> >messages is displayed.
> >
> >Can an error message be displayed under the input field if the property
> >being validated is indexed ?
> >
> >Fred
> >
> >
> > JSP
> >
> >
> >
> >
> >.../...
> > >property="parameters"
> >id="parameter"
> >type="com.rubis.web.system.bean.ParamInterfaceElementBean">
> >
> >
> > >property="orderNumber"
> >indexed="true"/>
> >
> >.../...
> >
> >
> >
> >
> > validation.xml
> > >property="orderNumber"
> >indexedListProperty="parameters"
> >depends="required,integer,positive">
> >
> >
> >
> >
> >
> >
> >
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
>
> --
> Your favorite stores, helpful shopping tools and great gift ideas.
> Experience the convenience of buying online with [EMAIL PROTECTED]
> http://shopnow.netscape.com/
>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]