我的网站是一个与保险相关的网站,因此在驾驶员进入驾驶员和车辆后,他们将进入覆盖页面 - 该页面将列出每个车辆旁边的每辆车,允许他们选择哪个车辆的覆盖范围。问题是它不断爆炸,我不明白为什么。这是JSP的一部分正在爆炸。这是coverages.jsp
<spring:bind path="quoteForm.${fn:toLowerCase(vehicleCoverageList.coverageCode)}[${vehicleIndex}]" >
<select name="${status.expression}" class="violationType" id="${vehicleCoverageList.coverageCode}" validate="selectOneOption" req="">
<c:if test="${vehicleCoverageList.isRequired == 'N'}">
<option value="-1"><spring:message code="coverage.decline" /></option>
</c:if>
<c:forEach var="vehicleCoverage" items="${vehicleCoverageList.limits}">
<option value="${vehicleCoverage.id}" <c:if test="${vehicleCoverage == 'TODO'}">SELECTED</c:if>>
${vehicleCoverage.coverageLimits}
<c:if test="${not empty vehicleCoverage.deductible}">
<spring:message code="coverage.deductible" />${vehicleCoverage.deductible}
</c:if>
</option>
</c:forEach>
</select>
</spring:bind>
我试图遵循这里给出的建议:http://mattfleming.com/node/134
表格:
public class QuoteForm extends AbstractRTRForm implements Serializable {
private List<CoverageCodeWrapper> accdth = new ArrayList<CoverageCodeWrapper>();// = LazyList.decorate(new ArrayList<CoverageCodeWrapper>(), FactoryUtils.instantiateFactory(CoverageCodeWrapper.class));
private List<CoverageCodeWrapper> addeq = new ArrayList<CoverageCodeWrapper>();// = LazyList.decorate(new ArrayList<CoverageCodeWrapper>(), FactoryUtils.instantiateFactory(CoverageCodeWrapper.class));
...
}
还有更多,但为了简单起见,我把它剪掉了。
FormAction:
@Override
protected Event finishSetupForm(RequestContext context) throws Exception {
form.getQuoteForm().setAccdth( this.getWrapper() );
form.getQuoteForm().setAddeq ( this.getWrapper() );
...
}
private List<CoverageCodeWrapper> getWrapper() {
CoverageCodeWrapper c = new CoverageCodeWrapper();
List<CoverageCodeWrapper> list = new ArrayList<CoverageCodeWrapper>();
list.add( c );
return list;
}
错误不是很有用,但我会给它:
org.apache.tiles.TilesException:包含路径'/WEB-INF/tiles/coverages.jsp'时的JSPException。包含页面时的ServletException。
我的目标是让用户只选择一个页面上所有车辆的所有覆盖范围,而不必浏览与车辆一样多的页面。表单使用Lists作为用户可以输入的车辆数量是可变的。
非常感谢任何帮助,谢谢 杰里
答案 0 :(得分:0)
我无法完成上述工作,因为我读过一篇参考文献,说明Spring只修复了版本3中的LazyList / autoPopulatingList,而我在版本2.5中修复了我重新设计的表单。
我将所有的报道都移到了单独的VO中:
public class CoverageVO {
private int coverage1;
private int coverage2;
...
}
然后我在表单中列出了这些对象:
public class CoverageForm {
List<CoverageVO> coverages;
}
然后由于车辆进入了上一个屏幕,我知道我需要多少,所以在FormAction类中我实例化它们:
public class CoverageFormAction extends FormAction {
@Override
protected Event finishSetupForm(RequestContext context) throws Exception {
...
for( int i = 0; i < vehicleCount; i++ )
form.getQuoteForm().getCoverages().add( new CoverageFormVO() );
...
}
}
所以在JSP中我可以按照各种博客中描述的方式进行:
...
<spring:bind path="rtrForm.coverageForm.coverages[${vehicleIndex}].${fn:toLowerCase(vehicleCoverageList.coverageCode)}" >
...