[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    Re: HashMap< String, ArrayList<String> >: Unable to populate the
From:       Wes Wannemacher <wesw () wantii ! com>
Date:       2008-04-30 5:48:33
Message-ID: 1209534513.6102.7.camel () wesw-laptop
[Download RAW message or body]

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@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic