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

Popular posts from this blog

php - Wordpress: Link a post to posts of another category manually -

delphi xe7 upload/download dropbox file using the rest client and show progress -

java - Get more than One value and display it -