You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Wes Wannemacher <we...@wantii.com> on 2008/04/30 07:48:33 UTC

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

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


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

Posted by ravi_eze <ra...@ivycomptech.com>.
Team,

any help??? now i configured the validation, workflow interceptors in my xml
file. I see an error for this field variable. 

I tried configuring the converter... but as always its also failing... 

< actionclass>-conversion.properties:
mapOfList=com.company.CustomMapConverter
Element_mapOfList=java.util.ArrayList
Key_mapOfList=java.lang.string

I see a weird behavior: only the convertToString() function being called... 

had any body fixed such issues???

please help

cheers,
ravi 


-- 
View this message in context: http://www.nabble.com/HashMap%3C-String%2C-ArrayList%3CString%3E-%3E%3A-Unable-to-populate-the-Array-List-from-JSP-tp16975469p17201293.html
Sent from the Struts - User mailing list archive at Nabble.com.


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


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

Posted by ravi_eze <ra...@ivycomptech.com>.
hi,

Thanks for he help. i am using as follows:

< s:checkboxlist name="mapOfList['key']" />

I see that this is not working and the mapOfList is not getting populated at
all. I tried out StrutsTypeConverter... then only convertToString() method
is being called. Any ideas as how to go with this issue???

sorry for the wrong example prev. 

regards,
ravi 
-- 
View this message in context: http://www.nabble.com/HashMap%3C-String%2C-ArrayList%3CString%3E-%3E%3A-Unable-to-populate-the-Array-List-from-JSP-tp16975469p17129314.html
Sent from the Struts - User mailing list archive at Nabble.com.


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