You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by One Way <on...@yahoo.com> on 2001/07/14 16:01:31 UTC
Formating data with Velocity
Is there a way to format the data in Velocity, e.g. 123456.78 needs to
be shown as 123,456.78 or $123,456.78 in a web page.
Thanks in advance
__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/
Re: Formating data with Velocity
Posted by Travis Low <tr...@dawnstar.org>.
java.text.NumberFormat works...
cheers,
-- Travis Low
<ma...@dawnstar.org>
<http://dawnstar.org/travis>
Geir Magnusson Jr. wrote:
> One Way wrote:
>
>>Is there a way to format the data in Velocity, e.g. 123456.78 needs to
>>be shown as 123,456.78 or $123,456.78 in a web page.
>>
>>
>
> Nothing in Velocity proper. This would be the domain of what we call a
> 'context tool', a class put into the context for use by the template
> designer, such as
>
> $formatTool.currency( "123456.76")
>
> There must be a library floating around somewhere to do this...
>
> geir
>
>
--
-- Travis Low
<ma...@dawnstar.org>
<http://dawnstar.org/travis>
RE: Formating data with Velocity
Posted by Tal Dayan <ta...@zapta.com>.
You may try
getCurrencyInstance() of
http://java.sun.com/products/jdk/1.2/docs/api/java/text/NumberFormat.html
and
http://java.sun.com/products/jdk/1.2/docs/api/java/text/DecimalFormat.html
but you will need to write a think interface and attache it to the template
context.
Tal
> -----Original Message-----
> From: gmj@mta8.srv.hcvlny.cv.net [mailto:gmj@mta8.srv.hcvlny.cv.net]On
> Behalf Of Geir Magnusson Jr.
> Sent: Saturday, July 14, 2001 7:22 AM
> To: velocity-user@jakarta.apache.org
> Subject: Re: Formating data with Velocity
>
>
> One Way wrote:
> >
> > Is there a way to format the data in Velocity, e.g. 123456.78 needs to
> > be shown as 123,456.78 or $123,456.78 in a web page.
> >
>
> Nothing in Velocity proper. This would be the domain of what we call a
> 'context tool', a class put into the context for use by the template
> designer, such as
>
> $formatTool.currency( "123456.76")
>
> There must be a library floating around somewhere to do this...
>
> geir
>
> --
> Geir Magnusson Jr. geirm@optonline.net
> System and Software Consulting
> Developing for the web? See http://jakarta.apache.org/velocity/
> You have a genius for suggesting things I've come a cropper with!
>
Re: Formating data with Velocity
Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
One Way wrote:
>
> Is there a way to format the data in Velocity, e.g. 123456.78 needs to
> be shown as 123,456.78 or $123,456.78 in a web page.
>
Nothing in Velocity proper. This would be the domain of what we call a
'context tool', a class put into the context for use by the template
designer, such as
$formatTool.currency( "123456.76")
There must be a library floating around somewhere to do this...
geir
--
Geir Magnusson Jr. geirm@optonline.net
System and Software Consulting
Developing for the web? See http://jakarta.apache.org/velocity/
You have a genius for suggesting things I've come a cropper with!