Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 40562 invoked from network); 1 Mar 2010 17:56:42 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 1 Mar 2010 17:56:42 -0000 Received: (qmail 38901 invoked by uid 500); 1 Mar 2010 17:56:38 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 38879 invoked by uid 500); 1 Mar 2010 17:56:38 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 38871 invoked by uid 99); 1 Mar 2010 17:56:38 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Mar 2010 17:56:38 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of azlist1@gmail.com designates 209.85.222.184 as permitted sender) Received: from [209.85.222.184] (HELO mail-pz0-f184.google.com) (209.85.222.184) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Mar 2010 17:56:30 +0000 Received: by pzk14 with SMTP id 14so3453994pzk.28 for ; Mon, 01 Mar 2010 09:56:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type; bh=nrY86tXLxtiQVD4WlPFOnXusUjOBoiwuVQfHS7yIizI=; b=snProbkxnJsTrYcJV08FdkF82HAl6Gge353IUmXKsHfq+JUmUhdkHn5MFy57JrAoyC rqN3HltYU7ezw01STSkpDYnZ/CGgNmDOILQQMJsKtAFCG9cqLa9wcqWlRQA8XXxTY3Zt goNwcWCj/iEXu8XBH7QG+n4BSCCEwFZ5Ba8SM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=OjnrflGzk9i9nZhMP3lvc5h8HN+kJ9Q5YUcpHrzAMQxTBNgq2Vg1IeQaDgAMsfpfip H/HZO7nFi1C+d+zUKvuGgY0acip+zvo3XQVyCBirdIfqL8JdxLyU9fN74N73XVjsieDN /WTvc6J7qodAQivPz9v2KrqcJPfu0ZpO1KgyE= MIME-Version: 1.0 Received: by 10.141.101.16 with SMTP id d16mr2655191rvm.122.1267466168582; Mon, 01 Mar 2010 09:56:08 -0800 (PST) Date: Mon, 1 Mar 2010 18:56:08 +0100 Message-ID: <76c1202b1003010956of0e2c10lba46b8a92c4ad45a@mail.gmail.com> Subject: Inserting data into nested collections From: Alex To: user@struts.apache.org Content-Type: multipart/alternative; boundary=000e0cd13910be42f30480c0f6cf X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd13910be42f30480c0f6cf Content-Type: text/plain; charset=ISO-8859-1 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> customAltTerms = new HashMap>(); /** * @return the customAltTerms */ public HashMap> getCustomAltTerms() { return customAltTerms; } /** * @param customAltTerms the customAltTerms to set */ public void setCustomAltTerms(HashMap< String, ArrayList> 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 : or or or 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 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. --000e0cd13910be42f30480c0f6cf--