struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prasanth <dbad...@pangburngroup.com>
Subject Re: HashMap with String as key
Date Thu, 14 Mar 2019 19:10:45 GMT
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.
>
> <input name="accountAllocation[22419-23545]" size="3" value="" id="AccountAllocations_accountAllocation_22419-23545_"
class="inline-input" type="text"> 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 <lukaszlenart@apache.org>
>>>> Sent: Tuesday, March 12, 2019 10:52 AM
>>>> To: Struts Users Mailing List <user@struts.apache.org>
>>>> Subject: Re: HashMap with String as key
>>>>
>>>> pon., 11 mar 2019 o 18:41 Prasanth <dbadmin@pangburngroup.com> 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
>>>
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message