Jun 06
Quick Tip: Formatting Number Columns with DisplayTag
Displaytag supports easy display of formatted number columns using the format attribute on <display:column> – however, it’s not really well documented on the Displaytag site. Here’s how to do simple number formatting without requiring a decorator class:
<displaytag:column property="amount" title="$ Amount" format="{0,number,#.##}"/>This will display a decimal formatted to a maximum of 2 decimal places!



August 18th, 2008 at 7:23 am
Do you know where can I find all the formatting rules?
Thanks
August 18th, 2008 at 7:53 am
Well, this syntax is actually instantiating a MessageFormatColumnDecorator behind the scenes. That Decorator simply hands off the contents of the column to an instance of MessageFormat with the specified pattern. So, the answer to your question is – “look at the MessageFormat Javadoc”. Hope that helps!
August 19th, 2008 at 1:06 am
It helped indeed!!
Thank you
September 14th, 2011 at 10:15 am
Hi, when I sort a displaytag column that contains numbers it is treated as string for example: (1,10,11,2,3,…etc)
I want the column to be sorted as integers like this (1,2,3,4,…,10,11,..etc)
How do I acheive this ?