struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Reumann <>
Subject Re: How to populate a map of lists in an action form?
Date Tue, 03 May 2005 17:52:42 GMT
I'm stumped on the below also and want to know how to get this work. 
Typically my Lists and Map have beans nested in them with access methods 
to other lists and maps, but I know there should be a way to get this 
below to work efficiently (where you simply stuff lists and maps into 
other lists/maps. What is frustrating is I can pull all of it out fine 
with JSTL

(A map with a single employees List which has a single Employee bean):
<c:out value='${testForm.testMap["employees"][0].firstName}'/>

(or a List wiht a List with an Employee bean in it):

<c:out value='${testForm.testList[0][0].lastName}'/>

How to create the inputs for this in HTML, though, has me stumped at the 

Daniel Lobo wrote the following on 5/3/2005 6:19 AM:
> Hi,
> I have an action form with a map that can be accessed with getters and 
> setters. That map holds lists of elements. The problem is how to 
> populate that lists from the html form . I've tried with:
> <input name="elementsMap(0).[0]" value="foo">
> and
> <input name="elementsMap(0)[0]" value="foo">
> but doesn't work.
> However, i've implemented a new class child of ArrayList that adds this 
> two methods:
>    public List getList()
>    {
>        return this;
>    }
>      public void setList(List list)
>    {
>        clear();
>        addAll(list);
>    }
> And using this class in the map I can do from javascript:
> <input name="elementsMap(0).list[0]" value="foo">
> And the population of the ActionForm works properly. ┬┐Does somebody know 
> how to fix this problem without the use of this two "ugly" methods?
> Thanks.
> ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message