struts-user mailing list archives

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

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

Is this normal?

Regards,
Sandy 

-----Oorspronkelijk bericht-----
Van: dusty [mailto:dustin_pearce@yahoo.com] 
Verzonden: dinsdag 18 augustus 2009 6:37
Aan: user@struts.apache.org
Onderwerp: Re: struts 2.1.5 type conversion error


The error/warning you are talking about happens when the conversion
fails. 
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
all.  

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:
> 
> Sandy.Verfaille@roularta.be 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

--
View this message in context:
http://www.nabble.com/struts-2.1.5-type-conversion-error-tp24534638p2501
8347.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
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
View raw message