You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Zoran Avtarovski <zo...@sparecreative.com> on 2009/03/05 11:18:45 UTC

Display BigDecimal Format

Our forms have some currency and and we need to display to 2 decimal points
when the data is prepopulated.

At the moment is displays as a single decimal point. I could specify all the
relevant fields in a package.properties file but I¹d like to do it across
the board for big decimals.

Do I have to create a custom type converter or is there a property I could
set.

Z.



Re: Display BigDecimal Format

Posted by Zoran Avtarovski <zo...@sparecreative.com>.
I did end up writing a custom type converter, but I really think that¹s
overkill. It would be great if there were a way to specify the BigDecmal
scale in the struts properties, or xwork-conversion properties.

Am I off the mark here or is it worthwhile doing something and submitting as
a patch?

Z.
> 
> Thanks Seshagari,
> 
> But I¹d have to do this in every action and on every form. I might just
> write a customConverter for BigDecimals and place it in my xwork properties
> file.
> 
> Z.
>> > 
>> > Hi
>> > 
>> > Follows  anapest code,  in  your action class. Me be resolved  your
>> problem.
>> > // Round two decimal function
>> >     double roundTwoDecimals(double amout) {
>> >         DecimalFormat twoCurrencyDecimalForm = new
>> > DecimalFormat(getText("#.##"));
>> >         return Double.valueOf(twoCurrencyDecimalForm.format(amout));
>> >     }
>> > 
>> > Thank you,
>> > Seshagiri V
>> > seshagiriv@kensium.com.
>> >  
>> > US Main: 877 KENSIUM (536.7486)
>> > US Fax:   312.242.3029
>> >  
>> > Kensium
>> > 200 S Wacker Dr, Suite 3100
>> > Chicago, IL 60606
>> >  
>> > Confidentiality Note:
>> > -----------------------------
>> > The information contained in this e-mail is strictly confidential and for
>> > the intended use of the addressee only. Any disclosure, use or copying of
>> > the information by anyone other than the intended recipient is prohibited.
>> > If you have received this message in error, please notify the sender
>> > immediately by return e-mail and securely discard this message.
>> >  
>> >  
>> > 
>> > -----Original Message-----
>> > From: Zoran Avtarovski [mailto:zoran@sparecreative.com]
>> > Sent: Thursday, March 05, 2009 3:49 PM
>> > To: Struts Users Mailing List
>> > Subject: Display BigDecimal Format
>> > 
>> > Our forms have some currency and and we need to display to 2 decimal points
>> > when the data is prepopulated.
>> > 
>> > At the moment is displays as a single decimal point. I could specify all >>
the
>> > relevant fields in a package.properties file but I¹d like to do it across
>> > the board for big decimals.
>> > 
>> > Do I have to create a custom type converter or is there a property I could
>> > set.
>> > 
>> > Z.
>> > 
>> > 
>> > 
>> > No virus found in this incoming message.
>> > Checked by AVG - www.avg.com
>> > Version: 8.0.237 / Virus Database: 270.11.8/1984 - Release Date: 03/04/09
>> > 19:17:00
>> > 
>> > 
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@struts.apache.org
>> > 
> 
> 



Re: Display BigDecimal Format

Posted by Zoran Avtarovski <zo...@sparecreative.com>.
Thanks Seshagari,

But I¹d have to do this in every action and on every form. I might just
write a customConverter for BigDecimals and place it in my xwork properties
file.

Z.
> 
> Hi
> 
> Follows  anapest code,  in  your action class. Me be resolved  your problem.
> // Round two decimal function
>     double roundTwoDecimals(double amout) {
>         DecimalFormat twoCurrencyDecimalForm = new
> DecimalFormat(getText("#.##"));
>         return Double.valueOf(twoCurrencyDecimalForm.format(amout));
>     }
> 
> Thank you,
> Seshagiri V
> seshagiriv@kensium.com.
>  
> US Main: 877 KENSIUM (536.7486)
> US Fax:   312.242.3029
>  
> Kensium
> 200 S Wacker Dr, Suite 3100
> Chicago, IL 60606
>  
> Confidentiality Note:
> -----------------------------
> The information contained in this e-mail is strictly confidential and for
> the intended use of the addressee only. Any disclosure, use or copying of
> the information by anyone other than the intended recipient is prohibited.
> If you have received this message in error, please notify the sender
> immediately by return e-mail and securely discard this message.
>  
>  
> 
> -----Original Message-----
> From: Zoran Avtarovski [mailto:zoran@sparecreative.com]
> Sent: Thursday, March 05, 2009 3:49 PM
> To: Struts Users Mailing List
> Subject: Display BigDecimal Format
> 
> Our forms have some currency and and we need to display to 2 decimal points
> when the data is prepopulated.
> 
> At the moment is displays as a single decimal point. I could specify all the
> relevant fields in a package.properties file but I¹d like to do it across
> the board for big decimals.
> 
> Do I have to create a custom type converter or is there a property I could
> set.
> 
> Z.
> 
> 
> 
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.0.237 / Virus Database: 270.11.8/1984 - Release Date: 03/04/09
> 19:17:00
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 



RE: Display BigDecimal Format

Posted by Seshagiri V <se...@kensium.com>.
Hi

Follows  anapest code,  in  your action class. Me be resolved  your problem.
// Round two decimal function
    double roundTwoDecimals(double amout) {
        DecimalFormat twoCurrencyDecimalForm = new
DecimalFormat(getText("#.##"));
        return Double.valueOf(twoCurrencyDecimalForm.format(amout));
    }

Thank you,
Seshagiri V
seshagiriv@kensium.com. 
 
US Main: 877 KENSIUM (536.7486)
US Fax:   312.242.3029
 
Kensium
200 S Wacker Dr, Suite 3100
Chicago, IL 60606
 
Confidentiality Note:
-----------------------------
The information contained in this e-mail is strictly confidential and for
the intended use of the addressee only. Any disclosure, use or copying of
the information by anyone other than the intended recipient is prohibited.
If you have received this message in error, please notify the sender
immediately by return e-mail and securely discard this message.
 
 

-----Original Message-----
From: Zoran Avtarovski [mailto:zoran@sparecreative.com] 
Sent: Thursday, March 05, 2009 3:49 PM
To: Struts Users Mailing List
Subject: Display BigDecimal Format

Our forms have some currency and and we need to display to 2 decimal points
when the data is prepopulated.

At the moment is displays as a single decimal point. I could specify all the
relevant fields in a package.properties file but I¹d like to do it across
the board for big decimals.

Do I have to create a custom type converter or is there a property I could
set.

Z.



No virus found in this incoming message.
Checked by AVG - www.avg.com 
Version: 8.0.237 / Virus Database: 270.11.8/1984 - Release Date: 03/04/09
19:17:00


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org