Struts help - javax.servlet.ServletException: BeanUtils.populate

Discussion in 'Java' started by Dix, Jan 11, 2006.

  1. Dix

    Dix Guest

    Hi all,

    This problem is driving me up the wall, any help would greatly restore
    my sanity...

    I have an ActionForm that has a Collection of Objects, which are
    indexed and can display fine, but when I click submit in the form, I
    get this ugly error:

    javax.servlet.ServletException: BeanUtils.populate
    org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
    org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:805)
    ....
    ....

    root cause:
    java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
    java.util.ArrayList.RangeCheck(ArrayList.java:546)
    java.util.ArrayList.get(ArrayList.java:321)
    org.apache.commons.beanutils.PropertyUtilsBean.getIndexedProperty(PropertyUtilsBean.java:433)
    org.apache.commons.beanutils.PropertyUtilsBean.getIndexedProperty(PropertyUtilsBean.java:340)
    org.apache.commons.beanutils.PropertyUtilsBean.getNestedProperty(PropertyUtilsBean.java:684)
    ....
    ....

    Here is my code:

    ActionForm fragment:

    public class ShowPermissionsForm extends ActionForm {

    // --------------------------------------------------------- Instance
    Variables
    private Collection info;
    private ArrayList r = new ArrayList();

    public void reset(ActionMapping mapping, HttpServletRequest request) {
    }

    public ArrayList getR() {
    return r;
    }

    public void setR(ArrayList r) {
    this.r = r;
    }

    JSP fragment:

    <html:form action="/showPermissions.do">
    <html:hidden property="id" />
    <html:hidden property="group" />

    <c:forEach var="r" items="${showPermissionsForm.r}">

    <tr onMouseOver="this.style.backgroundColor='#DFDFDF'"
    onMouseOut="this.style.backgroundColor='#FFFFFF'"
    onContextMenu="alert('blub!')">
    <html:hidden indexed="true" name="r" property="name" />
    <html:hidden indexed="true" name="r" property="is_table" />
    <td class="tabledata" width="50"><html:checkbox indexed="true" name="r"
    property="viewable"/></td>
    <td class="tabledata" width="50"><html:checkbox indexed="true" name="r"
    property="insert"/></td>
    <td class="tabledata" width="50"><html:checkbox indexed="true" name="r"
    property="update"/></td>
    <td class="tabledata" width="50"><html:checkbox indexed="true" name="r"
    property="delete"/></td>
    </tr>

    </c:forEach>
    </table><br/>
    <html:submit value="Save" styleClass="input_boxes"/>
    </html:form>


    Any ideas? I'm about to jump out the window...


    Best regards,

    Patrick
     
    Dix, Jan 11, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page