That is because you are using Struts 2.1.5. There is a bug in the type conversion for doubles in XWork which is fixed in the current version (XWork 2.1.4). When you enter a zero it claims it is not a valid value. To use XWork 2.1.4 you need Struts 2.1.7. I have just sent the zips I promised and you will find since I used 2.1.7 that negative numbers and zero work.
-----Original Message----- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Tue, Aug 18, 2009 4:43 am Subject: RE: struts 2.1.5 type conversion error 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_pea...@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.verfai...@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-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@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-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org