This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi, in a jsp i am displaying some numeric bean properties (all of them are strings) and i would like to know how could i apply a format to them. The problem is that <bean:write name="bean" property="p" format="###.##"/> does not work because it is a string so it doesn�t get formatted, any ideas? Thanks.
You're working too hard. The format attribute should contain a simple String indicating how to format the number. Change your code to:
Just make sure that the bytes property contains a number (float, double, etc.) rather than a String or other data type. If it doesn't, convert it to a numeric data type in the getter as I demonstrated in a previous post.