In jsp, I have a table whose rows I create in such a loop,
<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>
Suppose 5 such lines are added, each line will have id = itemPrice, but I want the lines to have:
id=itemPrice1 id=itemPrice2.. and so on..
How can I do it? Please, help..
source share