2013-11-25 38 views
0

獲取數據這是我在JSP如何ArrayList中從JSP

<form action="submit"> 
    <tr class="row" id="item1"> 
    <td><input type="text" name="type" class="type" style="width: 50px"/></td> 
    <td><input type="text" name="color" class="color" style="width: 50px"/></td> 
    <td><input type="text" name="qty" class="qty" style="width: 50px"/></td> 
    <td><input type="text" name="unitprice" class="unitPrice" style="width: 50px"/></td> 
</tr> 

... 
<tr class="row" id="itemN"> 
    <td><input type="text" name="type" class="type" style="width: 50px"/></td> 
    <td><input type="text" name="color" class="color" style="width: 50px"/></td> 
    <td><input type="text" name="qty" class="qty" style="width: 50px"/></td> 
    <td><input type="text" name="unitprice" class="unitPrice" style="width: 50px"/></td> 
</tr> 

</form> 

我要取的可能含有1到N個數據的形式和每個項目contais typecolorqtyunitprice。我想將所有這些數據存儲在ArrayList變量中。 如何做到這一點?

+0

通常XWork的類型轉換這樣做。 –

+0

XWork顯示爲 導入錯誤 'import com.atlassian.confluence.core.ConfluenceActionSupport'; – xrcwrn

回答

1

你需要的是Tabular Input

+0

不理解任何其他示例 – xrcwrn

+0

你不明白。你基本上必須迭代你的bean。像例如,如果你有一個bean(讓它命名爲Product),並且屬性是類型顏色數量和單位價格。因此,不是設置單個屬性,而是創建Product bean的列表,然後遍歷該列表並使用點符號在JSP中設置值。例如'' –

+0

我只需要從jsp tp arraylist – xrcwrn