gpt4 book ai didi

java - 为什么我的 ArrayList 没有填充到 struts (1.3) 中

转载 作者:搜寻专家 更新时间:2023-11-01 03:26:24 25 4
gpt4 key购买 nike

我的 ActionForm 有以下字段。

//form
private ArrayList<String> chargeIds = new ArrayList<String>();
public ArrayList<String> getChargeIds() {
return chargeIds;
}
public void setChargeIds(ArrayList<String> chargeIds) {
this.chargeIds = chargeIds;
}//form

在我的 jsp 中我这样写:-

//jsp
....

<html:form action="/PurchaseOrderAction" styleId="defaultForm">
<table>
<logic:iterate id="element" name="<%= Constants.SHOPPING_ORDER_CART_ITEMS %>" type="mypackage.ItemBean" >
<tr><td>
<logic:Equal name="element" property="promotedItem" value="true">
<html:select property="chargeIds" styleClass="transperentList" indexed="true">
<html:options collection="<%=Constants.ALL_CHARGES %>" property="key" labelProperty="name" />
</html:select>
</logic:Equal>
<logic:notEqual name="element" property="promotedItem" value="true">
<bean:write name="element" property="chargeName"/>
</logic:notEqual>
</tr></td>

.....
//jsp

我正在正确填充 jsp...但是当我提交表单时...我没有在我的表单 bean 的数组列表中获得任何值。

知道怎么做吗?我正在使用 struts 1.3(不幸的是无法更新,因为该项目从很久以前就开始了,而且我是团队的新成员)。

谢谢。

沙 git

最佳答案

尝试将表单对象中的 ArrayList 更改为 String[]

关于java - 为什么我的 ArrayList 没有填充到 struts (1.3) 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12889853/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com