« Return to Thread: HashMap< String, ArrayList >: Unable to populate the Array List from JSP

Re: HashMap< String, ArrayList<String> >: Unable to populate the Array List from JSP

by Wes Wannemacher :: Rate this Message:

Reply to Author | View in Thread

Assuming you have appropriate getters and setters on your action for the
HashMap of ArrayLists, you should be able to set them using indexing
like this -

<s:textfield name="mapOfList.key[i]" />
or
<s:textfield name="mapOfList['key'][i]" />

(where "i" is an integer representing the index where you want the
String set)

http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/indexing.html

-Wes


On Tue, 2008-04-29 at 21:54 -0700, ravi_eze wrote:

> hi,
>
> When we had the data structure as: HashMap<String,String> the following jsp
> fragment was able to populate it:
> <s:textfield name="map['key']" />
>
> but the same thing is not working with HashMap<String, ArrayList<Stirng> >
> when we tried:
> <s:textfield name="mapOfList['key']".
>
> We also tried instantiating the object in the action class constructor:
> mapOfList = new HashMap<... >();
> mapOfList.put("key", new ArrayList());
>
> still no luck.... Using POJOs instead of hashmap would not fit to my
> requirements.
>
> any help ???
>
> cheers,
> ravi


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...

 « Return to Thread: HashMap< String, ArrayList >: Unable to populate the Array List from JSP