struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Prasanth Pasala <>
Subject Re: HashMap with String as key
Date Tue, 12 Mar 2019 14:26:06 GMT

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.


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
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail:
>> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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