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

我的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 …但是当我提交表单时…我在我的formbean的arraylist中没有任何价值.

任何想法怎么样?我正在使用struts 1.3(遗憾的是无法更新,因为项目从很长一段时间开始,我是团队的新成员).

谢谢.

Sarjith

最佳答案 尝试在表单对象中将ArrayList更改为String [].

点赞