我的Form元素
//合同信息第一部分
private SysContractInfo contract_saveOrUpdate = new SysContractInfo();
//第二部分
private List<SysReceiptInfo> receipt_saveOrUpdate = new ArrayList<SysReceiptInfo>(); 其中contract_savaOrUpdate中存在 SysReceiptInfo 对像集合。目前想实现JSP页面Form直接填充元素到receipt_saveOrUpdate 集合中。我的JSP from 元素如下:<c:forEach var="item" items="${frontCommerceForm.agreement_saveOrUpdate.receipt_saveOrUpdate }" varStatus="index">
<tr>
<td style="background-color: #ffffff">
<html:text style="width:100%" onfocus="calendar(this,null);" styleClass="inputTest" property="agreement_saveOrUpdate.receipt_saveOrUpdate_createBallotDate[${index.index}]"/>
<c:if test="${not empty agreement_saveOrUpdate.receipt_saveOrUpdate[index.index].sysContractInfo.contractId }">
<html:hidden style="width:100%" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].sysContractInfo.contractId"/>
</c:if>
<c:if test="${empty agreement_saveOrUpdate.receipt_saveOrUpdate[index.index].sysContractInfo.contractId }">
<html:hidden style="width:100%" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].sysContractInfo.contractId"
value="${frontCommerceForm.agreement_saveOrUpdate.contract_saveOrUpdate.contractId }"/>
</c:if>
<c:if test="${not empty frontCommerceForm.agreement_saveOrUpdate.receipt_saveOrUpdate[index.index].id}">
<html:hidden style="width:100%" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].id"/>
</c:if>
</td>
<td style="background-color: #ffffff">
<html:text style="width:100%" styleClass="InputStyle" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].ballotPrice"/>
</td>
<td style="background-color: #ffffff">
<html:text style="width:100%" onfocus="calendar(this,null);" styleClass="inputTest" property="agreement_saveOrUpdate.receipt_saveOrUpdate_receiveDate[${index.index}]"/>
</td>
<td style="background-color: #ffffff">
<html:text style="width:100%" styleClass="InputStyle" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].price"/>
</td>
<td style="background-color: #ffffff">
<html:text style="width:100%" styleClass="InputStyle" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].balance"/>
</td>
<td style="background-color: #ffffff">
<html:text style="width:100%" styleClass="InputStyle" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].payMentUnit"/>
</td>
<td style="background-color: #ffffff">
<html:text style="width:100%" styleClass="InputStyle" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].linkMan"/>
</td>
<td style="background-color: #ffffff">
<html:text style="width:100%" styleClass="InputStyle" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].telephone"/>
</td>
</tr>
</c:forEach>每个元素写法
<html:text property="receipt_saveOrUpdate[${index.index}].price"/>
Price是SysReceiptInfo对象下成员
${index.index}是一个下标,自定义从0-10
声明:我在form初始化构造中进行过 对SysReceiptInfo 集合中填充10元素
页面加载出来时没有问题
页面一Submint时报如下错误环境:spring+struts1.2+hibernate
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:507)
at java.util.ArrayList.get(ArrayList.java:324)
at com.crystaldecisions.sdk.occa.infostore.internal.al.get(Unknown Source)
at com.businessobjects.BO.getDocumentInstance(BO.java:207)
at com.neusoft.tax.hxzg.hblt.bo.bl.applogic.BOUtil.getWebiPrompts(BOUtil.java:740)
at com.neusoft.tax.hxzg.hblt.bo.web.action.BOQueryAction.getWebiViewParameters(BOQueryAction.java:658)
at com.neusoft.tax.hxzg.hblt.bo.web.action.BOQueryAction.WebiView(BOQueryAction.java:785)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:196)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at com.neusoft.unieap.action.EAPActionServlet.process(EAPActionServlet.java:483) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1077)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.neusoft.tax.platform.framework.web.FilterServlet.doFilter(FilterServlet.java:97)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:7053)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3902)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
//合同信息第一部分
private SysContractInfo contract_saveOrUpdate = new SysContractInfo();
//第二部分
private List<SysReceiptInfo> receipt_saveOrUpdate = new ArrayList<SysReceiptInfo>(); 其中contract_savaOrUpdate中存在 SysReceiptInfo 对像集合。目前想实现JSP页面Form直接填充元素到receipt_saveOrUpdate 集合中。我的JSP from 元素如下:<c:forEach var="item" items="${frontCommerceForm.agreement_saveOrUpdate.receipt_saveOrUpdate }" varStatus="index">
<tr>
<td style="background-color: #ffffff">
<html:text style="width:100%" onfocus="calendar(this,null);" styleClass="inputTest" property="agreement_saveOrUpdate.receipt_saveOrUpdate_createBallotDate[${index.index}]"/>
<c:if test="${not empty agreement_saveOrUpdate.receipt_saveOrUpdate[index.index].sysContractInfo.contractId }">
<html:hidden style="width:100%" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].sysContractInfo.contractId"/>
</c:if>
<c:if test="${empty agreement_saveOrUpdate.receipt_saveOrUpdate[index.index].sysContractInfo.contractId }">
<html:hidden style="width:100%" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].sysContractInfo.contractId"
value="${frontCommerceForm.agreement_saveOrUpdate.contract_saveOrUpdate.contractId }"/>
</c:if>
<c:if test="${not empty frontCommerceForm.agreement_saveOrUpdate.receipt_saveOrUpdate[index.index].id}">
<html:hidden style="width:100%" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].id"/>
</c:if>
</td>
<td style="background-color: #ffffff">
<html:text style="width:100%" styleClass="InputStyle" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].ballotPrice"/>
</td>
<td style="background-color: #ffffff">
<html:text style="width:100%" onfocus="calendar(this,null);" styleClass="inputTest" property="agreement_saveOrUpdate.receipt_saveOrUpdate_receiveDate[${index.index}]"/>
</td>
<td style="background-color: #ffffff">
<html:text style="width:100%" styleClass="InputStyle" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].price"/>
</td>
<td style="background-color: #ffffff">
<html:text style="width:100%" styleClass="InputStyle" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].balance"/>
</td>
<td style="background-color: #ffffff">
<html:text style="width:100%" styleClass="InputStyle" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].payMentUnit"/>
</td>
<td style="background-color: #ffffff">
<html:text style="width:100%" styleClass="InputStyle" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].linkMan"/>
</td>
<td style="background-color: #ffffff">
<html:text style="width:100%" styleClass="InputStyle" property="agreement_saveOrUpdate.receipt_saveOrUpdate[${index.index}].telephone"/>
</td>
</tr>
</c:forEach>每个元素写法
<html:text property="receipt_saveOrUpdate[${index.index}].price"/>
Price是SysReceiptInfo对象下成员
${index.index}是一个下标,自定义从0-10
声明:我在form初始化构造中进行过 对SysReceiptInfo 集合中填充10元素
页面加载出来时没有问题
页面一Submint时报如下错误环境:spring+struts1.2+hibernate
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:507)
at java.util.ArrayList.get(ArrayList.java:324)
at com.crystaldecisions.sdk.occa.infostore.internal.al.get(Unknown Source)
at com.businessobjects.BO.getDocumentInstance(BO.java:207)
at com.neusoft.tax.hxzg.hblt.bo.bl.applogic.BOUtil.getWebiPrompts(BOUtil.java:740)
at com.neusoft.tax.hxzg.hblt.bo.web.action.BOQueryAction.getWebiViewParameters(BOQueryAction.java:658)
at com.neusoft.tax.hxzg.hblt.bo.web.action.BOQueryAction.WebiView(BOQueryAction.java:785)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:276)
at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:196)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
at com.neusoft.unieap.action.EAPActionServlet.process(EAPActionServlet.java:483) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1077)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at com.neusoft.tax.platform.framework.web.FilterServlet.doFilter(FilterServlet.java:97)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:7053)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3902)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
解决方案 »
- 求代码!
- html:select 标签的问题
- struts和hibernate的例子报错could not read mappings from resourse:userinfo.hbm.xml
- 请问各位高手怎样可以用java code调用outlook(急)
- 请教一个读取文件的问题!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- 错误调试求教
- 关于JBuilder2005+Weblogic8.1的J2EE开发教程详解
- 怎么样学习J2EE ???
- hibernate运行时报错,在本地juint单元测试正确,求大神帮助
- spring和mybatis整合时事物不回滚
- 关于权限。大家觉得有没有必要用acegi
- 简单的字符集问题
在做 <c:if test="${not empty frontCommerceForm.agreement_saveOrUpdate.receipt_saveOrUpdate[index.index].id}">之前 你应该先判断frontCommerceForm.agreement_saveOrUpdate.receipt_saveOrUpdate 是否为空 数组的大小是否不为0