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 ,valdiation.xml file and form : 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 ? If I try to modify the validation.xml in order to include : indexedListProperty="parameter" rather than indexedListProperty="parameters" (which I would image is the good thing to do in order to match the "parameter[i].orderNumber" property name), then I get an exception when validation happens. java.lang.NoSuchMethodException: Property 'parameter' has no getter method org.apache.commons.beanutils.PropertyUtils.getSimpleProperty(PropertyUtils.java:1180) org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:772) org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801) org.apache.commons.validator.Validator.validateField(Validator.java:487) org.apache.commons.validator.Validator.validate(Validator.java:582) org.apache.struts.validator.ValidatorActionForm.validate(ValidatorActionForm.java:121) com.rubis.web.system.action.SubmitStrategyAction.save(SubmitStrategyAction.java:71) Can anybody let me know what's wrong with my code ? Fred **** JSP **** <table> <th align="center"> <bean:message key="rubis.strategy.parameters.orderNumber"/> </th> .../... <logic:iterate name="strategyForm" property="parameters" id="parameter" type="com.rubis.web.system.bean.ParamInterfaceElementBean"> <tr> <td align="center"> <html:text name="parameter" property="orderNumber" indexed="true"/> </td> .../... </tr> </logic:iterate> </table> **** validation.xml **** <field property="orderNumber" indexedListProperty="parameters" depends="required,integer,positive"> <arg0 key="rubis.strategy.label"/> </field> *** form setter and getter methods *** 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); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]