Z
Zhao
Hi, I am using logic:iterate of struts.
Here is the issue I am facing. I need to present a table
with mutiple rows. in each row there is a text field, "add" (see the
code below), containing
number of items added to shipping cart and another static text
field (label type), "available", containing the maximum number can be
enter into field "add". When users click at the button "Add to cart",
I need to verify if the entered number is within the range of
0<add<available.
My question is: in order to verify the entered number, I need to
compare it with available. How can I get the "available" field
identified?
I used bean:write and couldn't find a attribute like "id" to place the
row
number on it (I plan to use a row number, "index" (see code below), to
connect "available", "add" and "Add to cart" so that when "Add to
cart" is
clicked struts can carry out the verification to compare "add" and
"available".
I am not sure if my description was clear enough so far. I tried to
use a
hidden field to contain all the info needed for verification using
<td><html:hidden property="availableBoo_<%= index %>" value="?"></td>
but got "Unterminated tag" error.
In other words, how can I compare columns in logic:iterate for
verification?
=========================== the jsp code =======================
<table border="">
....
<logic:iterate id="MyItem" name="ListForm" property="ItemList"
indexId="index">
<tr>
...
<td><bean:write name="MyItem" property="available"/> </td>
<td><html:text property="orderedNum" value="1"/><html:button
property="add" value="Add to cart"/> </td>
</tr>
</logic:iterate>
</table>
Thanks
Zhao
Here is the issue I am facing. I need to present a table
with mutiple rows. in each row there is a text field, "add" (see the
code below), containing
number of items added to shipping cart and another static text
field (label type), "available", containing the maximum number can be
enter into field "add". When users click at the button "Add to cart",
I need to verify if the entered number is within the range of
0<add<available.
My question is: in order to verify the entered number, I need to
compare it with available. How can I get the "available" field
identified?
I used bean:write and couldn't find a attribute like "id" to place the
row
number on it (I plan to use a row number, "index" (see code below), to
connect "available", "add" and "Add to cart" so that when "Add to
cart" is
clicked struts can carry out the verification to compare "add" and
"available".
I am not sure if my description was clear enough so far. I tried to
use a
hidden field to contain all the info needed for verification using
<td><html:hidden property="availableBoo_<%= index %>" value="?"></td>
but got "Unterminated tag" error.
In other words, how can I compare columns in logic:iterate for
verification?
=========================== the jsp code =======================
<table border="">
....
<logic:iterate id="MyItem" name="ListForm" property="ItemList"
indexId="index">
<tr>
...
<td><bean:write name="MyItem" property="available"/> </td>
<td><html:text property="orderedNum" value="1"/><html:button
property="add" value="Add to cart"/> </td>
</tr>
</logic:iterate>
</table>
Thanks
Zhao