I should have mentioned the get(String, int) is called to get the business object (bean) from the array, so it can then set the property. Since the array is empty it fails with any index. The only solution I can see is to override this method or use LazyValidatorForm (LazyDynaBean). Is there a recommended solution?
________________________________ From: Strachan, Paul [mailto:[EMAIL PROTECTED] Sent: Sat 9/12/2006 2:54 AM To: Struts Users Mailing List Subject: RE: Struts1: CHALLENGE "Indexed Properties can not be used with FORMS on REQUEST scope!" TRUE or NOT TRUE? Chris, In my DynForm I'm actually using a java.util.ArrayList (contains my bean objects). the http request contains properties: checkList[0].resultId=34&checkList[1].resultId=45 etc I havn't debugged using a String[] but the BeanUtilsBean.populate method works differently with properties. I'm not sure the best approach to handle an empty arraylist, but the point is you still have to do *something* - I'm just not sure what. Dumb question: - assuming your String[] is empty when the processPopulate starts, what is the code to grow it to accomodate a variable number of http request parameters? Thanks, Paul ________________________________ From: Christopher Schultz [mailto:[EMAIL PROTECTED] Sent: Sat 9/12/2006 1:27 AM To: Struts Users Mailing List Subject: Re: Struts1: CHALLENGE "Indexed Properties can not be used with FORMS on REQUEST scope!" TRUE or NOT TRUE? -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Paul, Strachan, Paul wrote: > A request scoped "out of the box" DynaValidatorForm is also unable to > handle indexed properties e.g. throws IndexOutOfBoundsException in > DynaActionForm.get(string, int) I've never used get(String, int), but I use request-scoped indexed properties all the time and use getStrings(String) just fine in that case. My setup in struct-config.xml: <form-bean name="questionSetForm" type="org.apache.struts.validator.DynaValidatorForm"> <form-property name="id" type="java.lang.String" /> <form-property name="name" type="java.lang.String" /> <form-property name="description" type="java.lang.String" /> <form-property name="addQuestionId" type="java.lang.String[]" /> <form-property name="deleteQuestionId" type="java.lang.String[]" /> </form-bean> Part of my form-handler action: // Add and remove the appropriate questions. List questions = getQuestionList(existingQuestions, questionSetForm.getStrings("addQuestionId"), questionSetForm.getStrings("deleteQuestionId")); If you are getting IndexOutOfBoundsException, then your loop might be running too long. How are you determining what the maximum index is that you can use? - -chris -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org <http://enigmail.mozdev.org/> <http://enigmail.mozdev.org/> iD8DBQFFeXZH9CaO5/Lv0PARAk8cAKDAtrEWWH1nl34JU75mKkGfh+IPswCffh6X 56p3VYmREkJLNH5by0RVysM= =yUyl -----END PGP SIGNATURE----- --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ********************************************************************** This message is intended for the addressee named and may contain privileged information or confidential information or both. If you are not the intended recipient please delete it and notify the sender. ********************************************************************** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ********************************************************************** This message is intended for the addressee named and may contain privileged information or confidential information or both. If you are not the intended recipient please delete it and notify the sender. ********************************************************************** --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]