Hi all,
I am completely new to Struts. I am studying about show-case examples. I
noticed that such a example:
The goal is updating multiple records at one time. For that,
in EditPersonAction.java
List persons = new ArrayList();
----
And in EditPerson.java
<s:iterator var="p" value="persons">
<tr>
<td>
<s:property value="%{id}" />
</td>
<td>
<s:textfield label="First Name"
name="persons(%{id}).name" value="%{name}" theme="simple" />
</td>
<td>
<s:textfield label="Last Name"
name="persons(%{id}).lastName" value="%{lastName}" theme="simple"/>
</td>
</tr>
</s:iterator>
----
There is a confusing thing for me which is name="persons(%{id}).name" . This
sets user in persons list in EditPersonAction.java . So the keypoint is here
that the index of person is up to "id". In this case, if the user id is a
big number, the index of person in personList is also directly proportional
its id. So it could be 1000000th entry in a list and the other values are
null.
My question is how can I implement this scenario with a MAP.
That is to say,
in EditPersonAction.java
Map<Long, Person> persons = new HashMap<Long, Person>();
----
What Should I do to implement that? Do Getter and setter of this property
should be changed? And in JSP side what should I do to provide that?
Thanks
--
View this message in context:
http://www.nabble.com/Map-instead-of-List-in-action-tp15561406p15561406.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]