it's possible to use java code in velocity template ? for example use this int template:
double x = minutes/60 + (((minutes % 60)<=15)?0.0:((minutes % 60)<=45)?0.5:1.0);
No, Velocity is just a simple templating engine which prints anything that's not valid Velocity syntax.
But it does support computations, although with a much a simpler set of operations. This works in Velocity:
#set ($x = $minutes / 60)
#if ($minutes % 60 <= 15)
#set ($x = $x + 0.0)
#elseif ($minutes % 60 <= 45)
#set ($x = $x + 0.5)
#else
#set ($x = $x + 1.0)
#end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With