創建一個表的行中的for循環在JSP我有一個表,它的行我創造了這樣一個循環,在JSP
<table>
<tr>
<th>Item</th>
<th>Quantity</th>
<th>Price</th>
<th>Total</th>
<th>Actions</th>
</tr>
<tr>
<%
String[] cartItems = (String[]) request.getSession().getAttribute("cartList");
for (int i = 0; i < cartItems.length; i++) {
%>
<td>
<input type="text" id="itemPrice" maxlength="5" size="5" style="border:none;" value="$<%= cartItem[3]%>" />
</td>
<% } %>
</tr>
</table>
設5個這樣的行補充說,每一行都會有該id = itemPrice,但我想要的行有:
id=itemPrice1
id=itemPrice2.. and so on..
我該如何做到這一點?請幫忙..
當然!爲什麼我沒有想到這一點!謝謝。 – sherry 2011-04-13 07:42:23