File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Error - dynamic form" Watch "Error - dynamic form" New topic
Author

Error - dynamic form

John Smith
Greenhorn

Joined: Oct 07, 2003
Posts: 15
My JSP
-------------------------------------------------------------------------
<logic:iterate id="choice" name="choices" indexId="idx"&rt;
<tr&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;
</tr&rt;
</logic:iterate&rt;
---------------------------------------------------------------------------

Struts-config.xml
---------------------------------------------------------------------------
<action path="/display_options" type="com.ubs.cmgr.ams.common.action.MessageOptionsAction" name="msgOptionForm"
scope="session" validate="false"&rt;
<forward name="success" path="/display_options_page.do" /&rt;
<forward name="fail" path="/index.do" /&rt;
</action&rt;
--------------------------------------------------------------------------

Action Class
--------------------------------------------------------------------------
DynaActionForm lf = (DynaActionForm)form;
String action = (String)request.getParameter("action");

log.info("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 = {};
if(action!=null)
{
//choicesToArray = (String[]) lf.get(CONTROL);
}

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

saveToken(request);
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: http://aspose.com/file-tools
 
subject: Error - dynamic form