I've been googling for information on how to access indexed form fields, but haven't
found much. I'm thinking i'm going about the problem the wrong way.
I have a table of addresses with a textbox on each row, so a user can enter their ID's
for an address. I want to pass my ID (saved in the bean) and their entered ID to an
action. The jsp looks fine, and when the action runs it prints out the last ID that
was entered, which makes sense -- thats what my code says to do.
How do I retrieve the values of an indexed field in the action?
-----------
JSP
-----------
<logic:iterate id="addy" collection="<%=addresstypes %>" type="Beans.AddressVO" >
<tr>
<logic:equal name="addy" property="addressType" value="1" > <!-- put a condition on
the bean - only print those of addresstype1 -->
<td><html:text property="addressID" indexed="true"/></td> <!-- addressID is the field
storing the users input -->
<!-- define a bean to get my address ID to be saved in the hidden field -->
<bean:define id="ourID" name="addy" property="id"/>
<!-- create hidden field to pass my id to the action -->
<html:hidden property="myId" value="ourID" indexed="true"/>
<td><font size = "-3"><bean:write name="addy" property="member_grp_name" />
</font></td>
<td><font size = "-3"><bean:write name="addy" property="line1" /> </font></td>
<td><font size = "-3"><bean:write name="addy" property="line2" /> </font></td>
<td><font size = "-3"><bean:write name="addy" property="city" /> </font></td>
<td><font size = "-3"><bean:write name="addy" property="state" /> </font></td>
<td><font size = "-3"><bean:write name="addy" property="zip" /> </font></td>
</logic:equal>
</tr>
</logic:iterate>
-------
ACTION
-------
String id = ((ChosenAddressesIDForm) form).getAddressID(); // only
able to get the last ID entered
HttpSession curSession = request.getSession ();
ArrayList al = (ArrayList)
curSession.getAttribute("chosenBTSTaddresses");
Object[] o = al.toArray();
int numberOfAddresses = o.length;
System.out.println("There are " + numberOfAddresses + " addresses ");
System.out.println("get address id" + id + " ");
System.out.println("===============================================");
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]