First of all, check you haven't written usrModList where you meant userModList anywhere, or vica versa (bit of a confusing choice of names, that). Other than that, how are you initializing the userModList property in the form bean? What does the form bean's reset() method do? Finally, how is the usrModList scripting variable named by the <logic:iterate/> tag defined / initialized? How is it tied to your form bean?

L.

Shyam Anand wrote:

Hi,

I'm using indexed properties to display an array of
radio buttons in my Struts 1.1 web application.
I get an exception shown below when I use "request"
scope for my form bean but things work fine with
"session" scope.
Could somebody tell me what I'm doing wrong. Is there
a way to make this work with "request" scope.

Any help will be greatly appreciated.

Thanks,
Shyam

################################
java.lang.reflect.InvocationTargetException:
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.RangeCheck(ArrayList.java:486)
        at java.util.ArrayList.get(ArrayList.java:302)
        at
dsap.application.form.ReqNewAccessForm.getUserModList(ReqNewAccessForm.java:363)
        at java.lang.reflect.Method.invoke(Native Method)
        at
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:493)
        at
org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:428)
        at
org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:770)
        at
org.apache.commons.beanutils.PropertyUtils.getProperty(PropertyUtils.java:801)
        at
org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:881)
        at
org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
        at
org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1097)
#################################

Given below are code snippets from my form bean and
JSP:

/**
    * Access method for the userModList property.
* * @return the current value of the userModList
property
    */
public ArrayList getUserModList() {
      return userModList;
   }
/**
    * Sets the value of the userModList property.
* * @param aUserModList the new value of the
userModList property
    */
public void setUserModList(ArrayList aUserModList) { userModList = aUserModList;
   }


    /**
    * Access method for the userModList property.
* */ public UserModule getUserModList(int index) {
      return (UserModule)userModList.get(index);
   }


    /**
    * Sets the value of the userModList property.
* */
   public void setUserModList(int index,UserModule
userModule) { userModList.set(index,userModule);
   }    

#########################################
JSP:


                                        <logic:iterate name="usrModList" 
scope="session"
id="userModList" >
                                        <tr>
                                        <td align="center"><bean:write 
name="userModList"
property="id"/></td>                         
                        
                                        
                                        <td>                                    
  
                                        <html:radio name="userModList"
property="odbcAccess" value="Y" indexed="true" />Yes &nbsp
                                        <html:radio name="userModList"
property="odbcAccess" value="N" indexed="true" />No    
                                        </td>
                                        
                                        <td>                                    
  
                                        <html:radio name="userModList"
property="wfAccess" value="Y" indexed="true" />Yes &nbsp
                                        <html:radio name="userModList"
property="wfAccess" value="N" indexed="true" />No      
                                        </td>

                                        </tr>
                                </logic:iterate>



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com


--
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/laurie


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to