Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Struts and the fly likes Error - dynamic form Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Error - dynamic form" Watch "Error - dynamic form" New topic

Error - dynamic form

John Smith

Joined: Oct 07, 2003
Posts: 15
<logic:iterate id="choice" name="choices" indexId="idx"&rt;
<td&rt;<bean:write name="choice" property="label"/&rt;</td&rt;
<td&rt;<%=idx.intValue()%&rt;: <html:radio property='<%="control["+ idx + "]" %&rt;' idName="choice" value="intrusiveIndicator" "/&rt;</td&rt;
<td&rt;<html:radio property='<%="control["+ idx + "]" %&rt;' idName="choice" value="nonIntrusiveIndicator"/&rt;</td&rt;
<td&rt;<html:radio property='<%="control["+ idx + "]" %&rt;' idName="choice" value="unsubscribeIndicator"/&rt;</td&rt;

<action path="/display_options" type="" name="msgOptionForm"
scope="session" validate="false"&rt;
<forward name="success" path="/" /&rt;
<forward name="fail" path="/" /&rt;

Action Class
DynaActionForm lf = (DynaActionForm)form;
String action = (String)request.getParameter("action");"lf.toString(): " + lf.toString());
Collection choices = new ArrayList();

choices.add(new AMSLabelValueBean("Client Letter"));
choices.add(new AMSLabelValueBean("COE Insurance - Cancel"));
choices.add(new AMSLabelValueBean("Dept Use Pending 1X"));

String[] choicesToArray = {};
//choicesToArray = (String[]) lf.get(CONTROL);

lf.set(CONTROL, new String[3]);
for(int i = 0; i < choicesToArray.length; i++)
{ +":messageType: " + choicesToArray[i]);
//lf.set(CONTROL, i, choicesToArray[i]);

request.getSession().setAttribute(CHOICES, choices);

does anybody know why I keep getting "java.lang.ArrayIndexOutOfBoundsException" error when I submit the form? The JSP code that I post is a part of form. it's Struts 1.1.

Thanks in advance.
I agree. Here's the link:
subject: Error - dynamic form
jQuery in Action, 3rd edition