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. Advertisements

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.
Similar Threads
  1. Klaus
    Replies:
    2
    Views:
    2,439
    praveentp007
    May 18, 2012
  2. Pia
    Replies:
    0
    Views:
    665
  3. HARI OM
    Replies:
    0
    Views:
    9,820
    HARI OM
    May 4, 2005
  4. Replies:
    0
    Views:
    3,847
  5. Replies:
    2
    Views:
    8,296
    JeremyStein
    Aug 25, 2006
  6. Replies:
    5
    Views:
    2,559
  7. Andrew Thompson

    javax.servlet and javax.servlet.http

    Andrew Thompson, Apr 24, 2007, in forum: Java
    Replies:
    1
    Views:
    912
    newbie_at_tomcat
    Apr 25, 2007
  8. Lew
    Replies:
    1
    Views:
    795
    newbie_at_tomcat
    Apr 25, 2007
Loading...