Hi list,
I am having hard time figuring out how to solve what seems to be a somewhat trivial problem ... I am using Struts 2 and OGNL in my JSP to send textfield values in my Action Class The struts Action looks something like this : public class MyAction extends ActionSupport { HashMap<String, ArrayList<String>> customAltTerms = new HashMap<String, ArrayList<String>>(); /** * @return the customAltTerms */ public HashMap<String, ArrayList<String>> getCustomAltTerms() { return customAltTerms; } /** * @param customAltTerms the customAltTerms to set */ public void setCustomAltTerms(HashMap< String, ArrayList<String>> customAltTerms) { this.customAltTerms = customAltTerms; } public String execute() throws Exception{ .... some code here to test what's in the hashmap after the form has been submited } .... other methods of the Action class } I am unable to insert the data collected from the textfields of the form into the HashMap. I have tried the following in my JSP : <s:textfield name="customAltTerms['someKey1'].value" /> or <s:textfield name="customAltTerms['someKey1'].value[0]" /> or <s:textfield name="customAltTerms['someKey1'][0]" /> or <s:textfield name="customAltTerms['someKey1'].[0]" /> I almost always end up with java.lang.String cannot be cast to java.util.ArrayList java.lang.ClassCastException: java.lang.String cannot be cast to java.util.ArrayList etc ... I also tried replacing the ArrayList with a String[] with the same result (ClassCastException). However if I use a HashMap<String, String> the key and the value are populated correctly.But of course I only get one value per key which is not what I intend to do. What syntax must I use in the "name" attribute of the textfield to have the actual value of the textefield inserted in the ArrayList containend in the HashMap for the given key? Thank you for helping me.