Re: Invalid Field Value when using Map

2019-06-19 Thread Prasanth Pasala

Hi Yasser,

I think at run time you can add any type of objects you want to the map. The 
checks are only at compile time on the data types of objects added to Maps.

Thanks,
Prasanth

On 6/19/19 1:29 AM, Yasser Zamani wrote:

Hi Prasanth,

I'm surprised how you get non digit characters in your map while both key and 
value are not String!

Regards.


-Original Message-
From: Prasanth 
Sent: Monday, June 17, 2019 8:52 PM
To: Struts Users Mailing List 
Subject: Invalid Field Value when using Map

Hi,

I have a form that uses maps to store data as shown below. When the user enters
valid numbers it works as expected, but when user enters non digit characters in
the text field a String object is saved in the map rather than showing a 
"Invalid
field value for field " message which is done for basic data types 
like
int/long/double. Is this something that struts has not implemented for maps yet,
as the annotations provide the expected data type?

     @Element(value=java.lang.Double.class)
     private HashMap deferralAmountValue = new
HashMap();
     @Element(value=java.lang.Double.class)
     private HashMap deferralPercentValue = new
HashMap();


Thanks,
Prasanth

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org





RE: Invalid Field Value when using Map

2019-06-19 Thread Yasser Zamani
Hi Prasanth,

I'm surprised how you get non digit characters in your map while both key and 
value are not String!

Regards.

>-Original Message-
>From: Prasanth 
>Sent: Monday, June 17, 2019 8:52 PM
>To: Struts Users Mailing List 
>Subject: Invalid Field Value when using Map
>
>Hi,
>
>I have a form that uses maps to store data as shown below. When the user enters
>valid numbers it works as expected, but when user enters non digit characters 
>in
>the text field a String object is saved in the map rather than showing a 
>"Invalid
>field value for field " message which is done for basic data types 
>like
>int/long/double. Is this something that struts has not implemented for maps 
>yet,
>as the annotations provide the expected data type?
>
>     @Element(value=java.lang.Double.class)
>     private HashMap deferralAmountValue = new
>HashMap();
>     @Element(value=java.lang.Double.class)
>     private HashMap deferralPercentValue = new
>HashMap();
>
>
>Thanks,
>Prasanth