struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <>
Subject RE: struts 2.1.5 type conversion error
Date Tue, 18 Aug 2009 08:43:43 GMT

The error only shows if i enter '0' or a negative number in my
Not with positive numbers.

Is this normal?


-----Oorspronkelijk bericht-----
Van: dusty [] 
Verzonden: dinsdag 18 augustus 2009 6:37
Onderwerp: Re: struts 2.1.5 type conversion error

The error/warning you are talking about happens when the conversion
Essentially, after it tries the conversion and can't do it then it tries
to apply the setXXX(String xxx), but that really is not what you want at

When you are using your own converters you want to be able to return a
NULL for example when you get a "" and you are expecting an id to
convert to some kind of object.  

newton.dave wrote:
> wrote:
>> I've changed my original setter to setStockAmountInt(int 
>> stockAmount), and kept setStockAmount(String stockAmount) so it could

>> be used by the default ognl conversion. Now I can work without 
>> errors, but it seems kind of strange to me that this is the normal 
>> way of working, is it?
> No; you shouldn't need to do that (and you're breaking JavaBean 
> convention by doing so). The default type conversion should be 
> converting the form values to int automatically.
> If it's not, something is very wrong, because this functionality has 
> been working for a very long time.
> Dave
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message