java.lang.ArrayIndexOutOfBoundsException
at java.lang.reflect.Array.get(Native Method)
at org.apache.struts.action.DynaActionForm.get(DynaActionForm.java:252)
at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:474)
at org.apache.commons.beanutils.PropertyUtils.getIndexedProperty(PropertyUtils.java:428)
at org.apache.commons.beanutils.PropertyUtils.getNestedProperty(PropertyUtils.java:750)
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:495)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:798)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:205)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.displaytag.filter.ResponseOverrideFilter.doFilter(ResponseOverrideFilter.java:125)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.gewt.sop.web.SOPActionFilter.doFilter(SOPActionFilter.java:217)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:595)在数据提交的时候出的异常,是在Struts1.x把数据自动封装到动态表单的时候出的异常吧,页面上是这样的结构
<nested:iterate>
<nested:iterate>
</nested:iterate>
<nested:iterate>
</nested:iterate>
</nest:iterate><form-bean name="jobDetailForm" type="org.apache.struts.action.DynaActionForm">
      <form-property name="sreport" type="com.gewt.sop.model.ServiceReport[]" />
其中,ServiceReport 里有 ReportTimesheet[] 这个类的数组哪位大神出来解决一下哈,在线等

解决方案 »

  1.   

    java.lang.ArrayIndexOutOfBoundsException 提交的数据貌似超过你定义的数组的大小
    不明真相,透露多点吧
      

  2.   

    <%//int k=-1; %>
    <nested:present property="sreport" name="jobDetailForm">
    <nested:iterate  property="sreport" name="jobDetailForm" type="com.gewt.sop.model.ServiceReport" indexId="k" >
     <%// k++; 
     String onchangemethd = "delServHrsRow(" + (k) +");";
    // ServRequestForSearch searchObj = (ServRequestForSearch)pageContext.getAttribute("serReqForSearch");
     //ServiceReport sreportOne = (ServiceReport)pageContext.getAttribute("sreport1");
     //ReportTimesheet[] timesheets = searchObj.getOneWeekTimeSheet();
     //ReportTimesheet[] timesheets = sreportOne.getOneWeekTimeSheet();
     //pageContext.setAttribute("timesheets",sreportOne.getOneWeekTimeSheet());
     //int timesheetInx1 = -1;
     //int timesheetInx2 = -1;
     %>

    <tr>

    <nested:hidden property="serviceRequestId" ></nested:hidden>
    <nested:hidden property="reportId" ></nested:hidden>
    <td align=center rowspan=2><nested:write  property="signCustomerName"/></td>
    <td align=center rowspan=2><nested:write  property="shipToN" /></td>
    <td align=center rowspan=2><nested:write  property="peId" />&nbsp&nbsp</td>
    <td align=center>
    <!-- Services -->
    <%=sopProperties.getString("submitAMReport.Services") %>
    </td>

    <nested:iterate  property="oneWeekTimeSheet"  type="com.gewt.sop.model.ReportTimesheet" indexId="timesheetInx1">
    <%
    //timesheetInx1++;
     %>


    <td>
     
    <nested:hidden property="serviceRequestId" ></nested:hidden>
    <nested:hidden property="entryId" ></nested:hidden>
    <nested:hidden property="serviceDateStr" ></nested:hidden>
    <nested:text property="travelDuration"  styleClass="width: 22px"></nested:text>
    <%-- 
    <input type="hidden" name="sreport[<%=k %>].oneWeekTimeSheet[<%=timesheetInx1 %>].serviceRequestId" value="<nested:write  property="serviceRequestId"/>"/>
    <input type="hidden" name="sreport[<%=k %>].oneWeekTimeSheet[<%=timesheetInx1 %>].serviceDateStr" value="<nested:write  property="serviceDateStr"/>" />
    <input type="hidden" name="sreport[<%=k %>].oneWeekTimeSheet[<%=timesheetInx1 %>].entryId" value="<%=timesheetInx1 %>"  />
    <input type='text'   name="sreport[<%=k %>].oneWeekTimeSheet[<%=timesheetInx1 %>].travelDuration" value="<nested:write  property="travelDuration"/>" style='width:22px;'/>
    --%>

    </td>
    </nested:iterate>

    <td>
    <input type="text" value=0 style="width: 22px"/>
    </td>

    <td rowspan=2>
    <input type="button" value="Delete" />
    </td>

    </tr>

    <tr>

    <td align=center>
    <!-- New Prospect Sales -->
    <%=sopProperties.getString("submitAMReport.NewProspectSales")%>
    </td>
    <nested:iterate  property="oneWeekTimeSheet"  type="com.gewt.sop.model.ReportTimesheet" indexId="timesheetInx2">
    <%
    //timesheetInx2++;
     %>


    <td>
    <nested:hidden property="serviceRequestId" ></nested:hidden>
    <nested:hidden property="entryId" ></nested:hidden>
    <nested:hidden property="serviceDateStr" ></nested:hidden>
    <nested:text property="travelDuration" styleClass="width: 22px"></nested:text>
    <%-- 
    <input type="hidden" name="sreport[<%=k %>].oneWeekTimeSheet[<%=timesheetInx2 %>].serviceRequestId" value="<nested:write  property="serviceRequestId"/>"/>
    <input type="hidden" name="sreport[<%=k %>].oneWeekTimeSheet[<%=timesheetInx2 %>].serviceDateStr" value="<nested:write  property="serviceDateStr"/>" />
    <input type="hidden" name="sreport[<%=k %>].oneWeekTimeSheet[<%=timesheetInx2 %>].entryId" value="<%=timesheetInx2 %>"  />
    <input type='text' name="sreport[<%=k %>].oneWeekTimeSheet[<%=timesheetInx2 %>].laborDuration" value="<nested:write  property="laborDuration"/>" style='width:22px;'/>
    </td>
    --%>
    </nested:iterate>

    <td>
    <input type="text" value=0 style="width: 22px"/>
    </td>
    </tr>

    </nested:iterate>
    </nested:present>
      

  3.   

    java.lang.ArrayIndexOutOfBoundsException;
    这句错误的意思是数组越界!!
      

  4.   

    sreport oneWeekTimeSheet 在FORM里没有初始化,在FORM的构造函数里new一下就好了,但是类型一定要匹配。
    <nested:iterate  property="“>iterate的property里的东西,在FORM的构造函数里必须初始化。
      

  5.   

    你使用迭代的时候,迭代的数组或者集合是null。