velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kishore Senji <kse...@gmail.com>
Subject Re: Can I perform math operations on longs with the #set() directive?
Date Sat, 09 Oct 2004 23:04:02 GMT
Use Math Tool.

http://jakarta.apache.org/velocity/tools/generic/MathTool.html




On Sat, 09 Oct 2004 16:59:06 +0100, pfpires.velocity@iol.pt
<pfpires.velocity@iol.pt> wrote:
> Hi all,
> 
> I'm using velocity to generate mails based on several templates.
> 
> I hava an application that stores certain information in *longs* (such as duration in
seconds and storage space in bytes).
> 
> I'd like to send emails with this information, but I'd like to convert it to different
units for readability purposes (bytes to Mb or Gb, and seconds to days). It nakes sense to
do this in the template (presentation layer), because if someone wants to have a diferent
kind of unit they can change the template (which is stored in the DB) and I don't have to
rebuild and redeploy the whole project.
> 
> I'd like to do something like #set($storage_mb = $storage_bytes/(1024*1024)) but, unfortunantlly
the #set() directive only allows operations in integers.
> 
> Can someone sujest another way to do this in the template?
> 
> --
> Thanx
> Pedro Pires
> 
> ________________________________________________________________________________
> A protecção do e-mail contra vírus é cada vez mais necessária!
> Proteja a sua Caixa de Correio: http://www.iol.pt/correio/rodape.php?dst=0409301
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
> 
>

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


Mime
View raw message