________________________________
From: jcyh24...@yahoo.ca.INVALID <jcyh24...@yahoo.ca.INVALID>
Sent: Saturday, June 22, 2019 12:47 AM
To: user@struts.apache.org
Subject: Re: Invalid Field Value when using Map

Hi Prasanth.

Do you have a small reproducer application available to demonstrate the 
behaviour ?  There might be something relevant in the configuration and setup 
too.

The behaviour you're seeing could have something to do with the @Element 
annotations identifying the types involved.  Maybe you can work-around the 
issue by providing explicit getters/setters using String values and perform 
direct type-conversions in those methods ?

Maybe another user has a suggestion (and if there's a reproducer application 
can comment further).

Regards,
James.


On 2019/06/17 16:21:55, Prasanth wrote:
> 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 <field name>" 
> 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<Long, Double> deferralAmountValue = new 
> HashMap<Long,Double>();
>     @Element(value=java.lang.Double.class)
>     private HashMap<Long, Double> deferralPercentValue = new 
> HashMap<Long,Double>();
>
>
> Thanks,
> Prasanth

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

Reply via email to