formatting - Is there analog of fmt:formatNumber in velocity like in jsp? -
now migrating jsp velocity template. cannot find solution how migrate following code line:
<fmt:formatnumber minfractiondigits='2' value='${campaign.budget div 100}'/>
does velocity can this?
you can use $numbertool.format("#0.00", $val)
should see 'org.apache.velocity.tools.generic.numbertool' more details.
to make working should add following maven dependency:
<dependency> <groupid>org.apache.velocity</groupid> <artifactid>velocity-tools</artifactid> <version>2.0</version> </dependency>
and write following code:
context.put("numbertool", new numbertool());
Comments
Post a Comment