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 guess
that number formatter will format 2 digits so 1.99
but if you supply it 3 digits so 1.999 it will try to round up. When that happens you get 2.00
If 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.3

johan


On 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.

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.9999 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.999999 or 1.9999, 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.999999 or 1.9999 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

Reply via email to