Re: [Wicket-user] Problem handling Double values
it is just a matter of rounding.. What to do ..On 8/2/06, Tom van Zummeren <[EMAIL PROTECTED]> wrote: Isn't this a problem out of our reach? Doubles are known to be not that accurate. Try to use a BigDecimal instead Tom From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] ] On Behalf Of Johan Compagner Sent: Saturday, July 29, 2006 14:32 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Problem handling Double values hmm thats odd i do see it now in our own FormInput example for the double field. will investigate that. johan On 7/29/06, Md. Kamruzzaman <[EMAIL PROTECTED]> wrote: Hi, Thank you for your reply. Actually I'm not reading data from database. I just giving input in the text box and when I press Save button, the corresponding text field data is being saved in the database. But since wicket retains the page state using model, the textbox is being filled with the rounded value I entered previously. Suppose I've entered 1. and then pressed Save button, it shows 2 in the textbox. Thank you. Md. kamruzzaman On 7/29/06, Juergen Donnerstag < [EMAIL PROTECTED]> wrote: The problem is not with code you've shown. It must be something else. The value in the database is correct. When you read the data from the database is it stored in a Double as well? Juergen On 7/26/06, Md. Kamruzzaman < [EMAIL PROTECTED]> wrote: > > > Hi, > I'm having great problem with handling Double values in the text box. When > I am entering a double value in a text box with more than 3 precisions like > 1.99 or 1., it is being saved in the database accurately, but the > post back value showing in the text box is rounded to next Integer (in case > of 1.99 or 1. it is showing 2). > > My sample code is given below: > > add(new RequiredTextField("amount", Double.class)); > > > Looking forward to have a good solution from you. > > > --Md. Kamruzzaman > > > > - > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -Take Surveys. Earn Cash. Influence the Future of ITJoin SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Problem handling Double values
Isn’t this a problem out of our reach? Doubles are known to be not that accurate. Try to use a BigDecimal instead Tom From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Johan Compagner Sent: Saturday, July 29, 2006 14:32 To: wicket-user@lists.sourceforge.net Subject: Re: [Wicket-user] Problem handling Double values hmm thats odd i do see it now in our own FormInput example for the double field. will investigate that. johan On 7/29/06, Md. Kamruzzaman <[EMAIL PROTECTED]> wrote: Hi, Thank you for your reply. Actually I'm not reading data from database. I just giving input in the text box and when I press Save button, the corresponding text field data is being saved in the database. But since wicket retains the page state using model, the textbox is being filled with the rounded value I entered previously. Suppose I've entered 1. and then pressed Save button, it shows 2 in the textbox. Thank you. Md. kamruzzaman On 7/29/06, Juergen Donnerstag < [EMAIL PROTECTED]> wrote: The problem is not with code you've shown. It must be something else. The value in the database is correct. When you read the data from the database is it stored in a Double as well? Juergen On 7/26/06, Md. Kamruzzaman < [EMAIL PROTECTED]> wrote: > > > Hi, > I'm having great problem with handling Double values in the text box. When > I am entering a double value in a text box with more than 3 precisions like > 1.99 or 1., it is being saved in the database accurately, but the > post back value showing in the text box is rounded to next Integer (in case > of 1.99 or 1. it is showing 2). > > My sample code is given below: > > add(new RequiredTextField("amount", Double.class)); > > > Looking forward to have a good solution from you. > > > --Md. Kamruzzaman > > > > - > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Problem handling Double values
Ok investigated it.And it is the way the NumberFormat.getInstance(locale); works (i tested it for the locale en )You get there a number formatter that does a RoundUp by default i guessthat number formatter will format 2 digits so 1.99but if you supply it 3 digits so 1.999 it will try to round up. When that happens you get 2.00If you don't want that you have to supply your own converterd for that so you have to override getConverter() of component for you double fields. Or supply you own converter for everything through the converter factory.In 1.2 this is a bit harder to override/supply your own converters just for a specific type (both ways String<->Number) in 2.0 this is much better and maybe we will try to backport it to 1.3johanOn 7/29/06, Johan Compagner < [EMAIL PROTECTED]> wrote:hmm thats odd i do see it now in our own FormInput example for the double field. will investigate that.johanOn 7/29/06, Md. Kamruzzaman <[EMAIL PROTECTED]> wrote: Hi, Thank you for your reply. Actually I'm not reading data from database. I just giving input in the text box and when I press Save button, the corresponding text field data is being saved in the database. But since wicket retains the page state using model, the textbox is being filled with the rounded value I entered previously. Suppose I've entered 1. and then pressed Save button, it shows 2 in the textbox. Thank you. Md. kamruzzaman On 7/29/06, Juergen Donnerstag < [EMAIL PROTECTED]> wrote: The problem is not with code you've shown. It must be something else.The value in the database is correct. When you read the data from thedatabase is it stored in a Double as well?JuergenOn 7/26/06, Md. Kamruzzaman < [EMAIL PROTECTED] > wrote:>>> Hi, > I'm having great problem with handling Double values in the text box. When> I am entering a double value in a text box with more than 3 precisions like > 1.99 or 1., it is being saved in the database accurately, but the> post back value showing in the text box is rounded to next Integer (in case> of 1.99 or 1. it is showing 2).> > My sample code is given below:>> add(new RequiredTextField("amount", Double.class));>>> Looking forward to have a good solution from you.>>> --Md. Kamruzzaman -> Take Surveys. Earn Cash. Influence the Future of IT> Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> ___> Wicket-user mailing list> Wicket-user@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/wicket-user>>>-Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share youropinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -Take Surveys. Earn Cash. Influence the Future of ITJoin SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Problem handling Double values
hmm thats odd i do see it now in our own FormInput example for the double field.will investigate that.johanOn 7/29/06, Md. Kamruzzaman <[EMAIL PROTECTED]> wrote: Hi, Thank you for your reply. Actually I'm not reading data from database. I just giving input in the text box and when I press Save button, the corresponding text field data is being saved in the database. But since wicket retains the page state using model, the textbox is being filled with the rounded value I entered previously. Suppose I've entered 1. and then pressed Save button, it shows 2 in the textbox. Thank you. Md. kamruzzaman On 7/29/06, Juergen Donnerstag < [EMAIL PROTECTED]> wrote: The problem is not with code you've shown. It must be something else.The value in the database is correct. When you read the data from thedatabase is it stored in a Double as well?JuergenOn 7/26/06, Md. Kamruzzaman < [EMAIL PROTECTED]> wrote:>>> Hi, > I'm having great problem with handling Double values in the text box. When> I am entering a double value in a text box with more than 3 precisions like > 1.99 or 1., it is being saved in the database accurately, but the> post back value showing in the text box is rounded to next Integer (in case> of 1.99 or 1. it is showing 2).> > My sample code is given below:>> add(new RequiredTextField("amount", Double.class));>>> Looking forward to have a good solution from you.>>> --Md. Kamruzzaman -> Take Surveys. Earn Cash. Influence the Future of IT> Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> ___> Wicket-user mailing list> Wicket-user@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/wicket-user>>>-Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share youropinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user -Take Surveys. Earn Cash. Influence the Future of ITJoin SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___Wicket-user mailing list Wicket-user@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Problem handling Double values
Hi, Thank you for your reply. Actually I'm not reading data from database. I just giving input in the text box and when I press Save button, the corresponding text field data is being saved in the database. But since wicket retains the page state using model, the textbox is being filled with the rounded value I entered previously. Suppose I've entered 1. and then pressed Save button, it shows 2 in the textbox. Thank you. Md. kamruzzaman On 7/29/06, Juergen Donnerstag <[EMAIL PROTECTED]> wrote: The problem is not with code you've shown. It must be something else.The value in the database is correct. When you read the data from thedatabase is it stored in a Double as well?JuergenOn 7/26/06, Md. Kamruzzaman < [EMAIL PROTECTED]> wrote:>>> Hi,> I'm having great problem with handling Double values in the text box. When> I am entering a double value in a text box with more than 3 precisions like > 1.99 or 1., it is being saved in the database accurately, but the> post back value showing in the text box is rounded to next Integer (in case> of 1.99 or 1. it is showing 2).> > My sample code is given below:>> add(new RequiredTextField("amount", Double.class));>>> Looking forward to have a good solution from you.>>> --Md. Kamruzzaman -> Take Surveys. Earn Cash. Influence the Future of IT> Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >> ___> Wicket-user mailing list> Wicket-user@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/wicket-user>>>-Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share youropinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Problem handling Double values
The problem is not with code you've shown. It must be something else. The value in the database is correct. When you read the data from the database is it stored in a Double as well? Juergen On 7/26/06, Md. Kamruzzaman <[EMAIL PROTECTED]> wrote: > > > Hi, > I'm having great problem with handling Double values in the text box. When > I am entering a double value in a text box with more than 3 precisions like > 1.99 or 1., it is being saved in the database accurately, but the > post back value showing in the text box is rounded to next Integer (in case > of 1.99 or 1. it is showing 2). > > My sample code is given below: > > add(new RequiredTextField("amount", Double.class)); > > > Looking forward to have a good solution from you. > > > --Md. Kamruzzaman > > > > - > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Problem handling Double values
Hi, I'm having great problem with handling Double values in the text box. When I am entering a double value in a text box with more than 3 precisions like 1.99 or 1., it is being saved in the database accurately, but the post back value showing in the text box is rounded to next Integer (in case of 1.99 or 1. it is showing 2). My sample code is given below: add(new RequiredTextField("amount", Double.class)); Looking forward to have a good solution from you. --Md. Kamruzzaman - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user