Chris, 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?
Regards, sandy -----Oorspronkelijk bericht----- Van: musom...@aol.com [mailto:musom...@aol.com] Verzonden: maandag 17 augustus 2009 11:53 Aan: user@struts.apache.org Onderwerp: Re: struts 2.1.5 type conversion error OGNL properties are JavaBean properties. In your case you are trying to define the property stockAmount twice with two different types. Instead of overloading the setter give it a different name: public void setStockAmountStr(String stockAmount) { this.stockAmount = Integer.parseInt(stockAmount); } Now you have two properties even though the data is in one field. Chris -----Original Message----- From: sandy.verfai...@roularta.be To: user@struts.apache.org Sent: Mon, Aug 17, 2009 4:26 am Subject: RE: struts 2.1.5 type conversion error Eduard, I have in my class: private int stockAmount; public void setStockAmount(int stockAmount) { this.stockAmount = stockAmount; } public int getStockAmount() { return stockAmount; } public void setStockAmount(String stockAmount) { this.stockAmount = Integer.parseInt(stockAmount); } And in my jsp: <s:form action="addProduct" method="post" validate="true" namespace="/service"> Stockamount<s:textfield name="stockAmount" /> </s:form> When I enter a number in stockamount (above 0) it goes well, when i enter a letter it goes wrong, saying 'no such method error setStockAmount(java.lang.String) I have no conversion xml or <class-name>.properties file.. Regards, SAndy -----Oorspronkelijk bericht----- Van: Eduard Neuwirt [mailto:eduard.neuw...@googlemail.com] Verzonden: maandag 17 augustus 2009 9:38 Aan: Struts Users Mailing List Onder werp: Re: struts 2.1.5 type conversion error Hi Sandy, please use additionally to the conversion xml the of the declaration corresponding member attributes as double, int etc. I think there are several examples for the <class-name>.properties files. Regards Eduard Neuwirt sandy.verfai...@roularta.be schrieb: > Martin, > > Then why are there validator xmls in which you can say what type your > input should be? > Shall I give all my int variables in my class a String-setter? > > Thx for the answer, > Sandy > > > -----Oorspronkelijk bericht----- > Van: Martin Gainty [mailto:mgai...@hotmail.com] > Verzonden: donderdag 13 augustus 2009 18:45 > Aan: Struts Users Mailing List > Onderwerp: RE: struts 2.1.5 type conversion error > > > http transmits strings (not int,double,date or any other type of > primitive) > > Martin Gainty > je ne suis pas d'accord avec ce que vous dites. > mais je défendrai à ma mort votre droite de la dire. - Voltaire ______________________________________________ > Note de déni et de confidentialité > Ce message est confidentiel et peut être privilégié. Si vous n'êtes > pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, no us ne pouvons accepter aucune responsabilité pour le contenu fourni. > > > > > >> Subject: RE: struts 2.1.5 type conversion error >> Date: Thu, 13 Aug 2009 16:11:55 +0200 >> From: sandy.verfai...@roularta.be >> To: user@struts.apache.org >> >> Lukasz, >> >> The type of 'price' is a double.. >> >> Thx for answering. >> >> Regards, >> sandy >> >> -----Oorspronkelijk bericht----- >> Van: Lukasz Lenart [mailto:lukasz.len...@googlemail.com] >> Verzonden: woensdag 22 juli 2009 9:50 >> Aan: Struts Users Mailing List >> Onderwerp: Re: struts 2.1.5 type conversion error >> >> 2009/7/17 <sandy.verfai...@roularta.be>: >> >>> <s:form action="addProduct" method="post" validate="true" > Name >>> nl<s:textfield name="nameNl" /> price<s:textfield name="price" >>> value=""/> </s:form> >>> >> What type has "price" in action class? >> >> >> Regards >> -- >> Lukasz >> http://www.lenart.org.pl/ >> http://dailylog.lenart.org.pl/ >> >> Charles de Gaulle - "The better I get to know men, the more I find >> myself loving dogs." - >> http://www.brainyquote.com/quotes/authors/c/charles_de_gaulle.html >> >> --------------------------------------------------------------------- >> 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 >> >> > > _________________________________________________________________ > Get your vacation photos on your phone! > http://windowsliveformobile.com/en-us/photos/default.aspx?&OCID=0809TL > -HM > > --------------------------------------------------------------------- > 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 --------------------------------------------------------------------- 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