From user-return-219316-archive-asf-public=cust-asf.ponee.io@struts.apache.org Thu Mar 14 19:11:01 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id D4BC0180630 for ; Thu, 14 Mar 2019 20:11:00 +0100 (CET) Received: (qmail 20735 invoked by uid 500); 14 Mar 2019 19:10:59 -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 20722 invoked by uid 99); 14 Mar 2019 19:10:58 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Mar 2019 19:10:58 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 6F8811805DF for ; Thu, 14 Mar 2019 19:10:58 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2 X-Spam-Level: ** X-Spam-Status: No, score=2 tagged_above=-999 required=6.31 tests=[HTML_MESSAGE=2, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id BgTfCRbk6l0b for ; Thu, 14 Mar 2019 19:10:53 +0000 (UTC) Received: from mail.nqadmin.com (mail.nqadmin.com [12.230.133.169]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id D93DB5FCA0 for ; Thu, 14 Mar 2019 19:10:52 +0000 (UTC) Received: (from root@localhost) by mail.nqadmin.com (8.14.7/8.14.7) id x2EJAjwe019129 for user@struts.apache.org; Thu, 14 Mar 2019 14:10:45 -0500 Received: from ppasalalinux.nqadmin.com (ppasalalinux.nqadmin.com [192.168.0.234]) by mail.nqadmin.com with SMTP id qrmezangpbk7uqxiz55rw5i2gw; for user@struts.apache.org; Thu, 14 Mar 2019 14:10:45 -0500 (CDT) (envelope-from dbadmin@pangburngroup.com) Subject: Re: HashMap with String as key To: user@struts.apache.org References: <84e5087f-f7ff-97ec-242c-21c4aee1d835@pangburngroup.com> Reply-To: dbadmin@pangburngroup.com From: Prasanth Message-ID: Date: Thu, 14 Mar 2019 14:10:45 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <84e5087f-f7ff-97ec-242c-21c4aee1d835@pangburngroup.com> Content-Type: multipart/alternative; boundary="------------205517CC88F4CB39CDB7D5A2" Content-Language: en-US --------------205517CC88F4CB39CDB7D5A2 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit The text field is also correctly populated based on the values in the hashmap (populated from database before showing the form). So the filed is correctly linked to the hashmap. I have even tried using an alphabet as a separator but that doesn't work either. But if I remove the hyphen (2241923545 as key) then the hashmap is populated, but I wouldn't be able to get the two values separated out if there is no separated. I could multiply one number with million and add another number to come up with a single number, but it will eventually create a problem as these keys grow. If there a setting for struts that need to be changed to allow non numeric keys? Thanks, Prasanth On 3/13/19 5:13 PM, Prasanth wrote: > The html form generated is correctly showing the key but the hashmap doesn't have a value for 22419-23545 when the form is submitted. > > Thanks, Prasanth > > On 3/12/19 9:26 AM, Prasanth Pasala wrote: >> Lukasz, >> >> There is no new keys in the hash map. The hash map is not updated at all. Before the form is displayed to the user, the hash map is populated based on the data in the database. These values are >> correctly displayed to the user in the text fields. But when the form is submitted by the user the data doesn't get populated in the hash map. Only the data I have populated in the hash map is present >> (as the model class is stored in session using scope interceptor) doesn't matter what values I type in the text fields. >> >> Yasser,  That is right the key is a string, not long. >> >> Also as I was testing this (having keys with and with out hyphen) I realized that any values that I have added to hash map before showing the form are still in the map. The new values from the form >> (keys without hyphen) got added to the hash map. I was under the impression that struts would set a new hash map with just the keys present in the form. >> >> Thanks, >> Prasanth >> >> On 3/12/19 4:12 AM, Yasser Zamani wrote: >>> (regarding your previous emails background) Please also consider that the key 2432-123 is not further Long. It's String. >>> >>> Regards. >>> >>>> -----Original Message----- >>>> From: Lukasz Lenart >>>> Sent: Tuesday, March 12, 2019 10:52 AM >>>> To: Struts Users Mailing List >>>> Subject: Re: HashMap with String as key >>>> >>>> pon., 11 mar 2019 o 18:41 Prasanth napisał(a): >>>>> When you have a HashMap backed form and String as key, are there any >>>> restrictions on the characters allowed? >>>>> I have keys like "2432-123" as I have to incorporate two ids in the >>>>> key. When I have these keys the HashMap is not getting populated. If I change >>>> it, so that there is only one id (no hyphen) then the data is getting posted as >>>> expected. >>>> >>>> I assume it's because of the "-" (minus) sign, and OGNL performs an evaluation or >>>> something. Could you check if you have key 2309 in your map as a result of >>>> distraction operation (2432-123 = 2309)? >>>> >>>> >>>> Regards >>>> -- >>>> Łukasz >>>> + 48 606 323 122 http://www.lenart.org.pl/ >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org >>>> For additional commands, e-mail: user-help@struts.apache.org >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org >>> For additional commands, e-mail: user-help@struts.apache.org >>> > --------------205517CC88F4CB39CDB7D5A2--