First thing is I can't use Struts 2.0. I think you didn't understand my problem. So i'm giving all the details from struts-config.xml file onwards...
struts-config.xml ============ <form-beans> <form-bean name="multipleFieldForm" type="org.apache.struts.action.DynaActionForm"> <form-property name="choices" type="java.lang.String[]" /> </form-bean> </form-beans> pollsForm.jsp ========== <html:form method="get" action="/multipleForm"> <html:text property="choices" /><br/> <html:text property="choices" /><br/> <html:submit /> </html:form> If i use the above form the choices that are entered by user are recived in the ActionForm as follows: MultipleFormAction.java --- execute() =========================== DynaActionForm dynaForm = (DynaActionForm)form; String[] choices = (String[]) dynaForm.get("choices"); System.out.println("<ol>"); for(int i=0;i<choices.length;i++) { System.out.println("<li>"+choices[i]+"</li>"); } System.out.println("</ol>"); But if it use the choices fields in array form i.e., pollsForm.jsp ========== <html:form method="get" action="/multipleForm"> <html:text property="choices[0]" /><br/> <html:text property="choices[1]" /><br/> <html:submit /> </html:form> If i follow the above procedure i'm getting ArrayIndexOutOfBoundsException. I tried setting size attribute in <form-property> element. But When that size exceeds i'm getting the same exception. So what i want is to add dynamic number of choce-fields in the above html-array type form and get them into my ActionForm object. Please friends help!!!!!!!!!!!!!!! On Mon, May 5, 2008 at 6:30 AM, Martin Gainty <[EMAIL PROTECTED]> wrote: > Why not use Autocompleter? > > When used on the "simple" theme, the autocompleter can be used like the > ComboBox. > When used on the "ajax" theme, the list can be retieved from an action. > > > http://struts.apache.org/2.0.6/struts2-core/apidocs/org/apache/struts2/components/Autocompleter.html > ----- Original Message ----- From: "Mead Lai" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <user@struts.apache.org> > Sent: Sunday, May 04, 2008 8:43 PM > Subject: Re: How to get dynamic number of arguments into ActionForm > > > > List type >> >> On Sun, May 4, 2008 at 7:51 PM, venkat reddy <[EMAIL PROTECTED]> >> wrote: >> >>> I'm using struts 1.2.7 >>> >>> I've a poll-posting-form in adminstrator section of my application. >>> format >>> of the form is as follows. >>> >>> pollsubject: String >>> lastDate:String >>> choice1:String >>> choice2:String >>> . >>> . >>> . >>> <a href="addChoice();">Add another option</a> >>> >>> As you can see here, the number of choices are dynamic and i want to add >>> a >>> link to give the administrator another choice field. >>> >>> Now, how can i get these dynamic fields into my ActionForm and what type >>> of >>> object should i declare in <form-beans> tag. explain in detail plz >>> >>> >> --------------------------------------------------------------------- >> 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] > >