In a jsp I have a table whose rows I am creating in a loop like this,
| Item | Quantity | Price | &lSolution 1:
<inputtype="text"id="itemPrice<%=i%>" maxlength="5" size="5" style="border:none;" value="$<%= cartItem[3]%>" />
Note what happened with the "id". It's just the counter in the for sentence.
Solution 2:
I'd say this should work (not tested):
Replace id="itemPrice" with id="itemPrice${i+1}"
This way, you're inserting value of i inside of your html.
If this doesn't work, try id="itemPrice<%=i+1%>".
|---|
Post a Comment for "Creating Rows Of A Table In A For Loop In Jsp"