This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
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 Make it so: Java DB Connections & Transactions this week in the JDBC 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
It's not a secret anymore!