This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I would like to format the value as currency, though--specifically, US Dollars. I searched the FAQ and Struts forum for this, and found several threads with similar questions, but didn't find any particularly elegant solutions.
In this thread, Elaine Micheals showed how to format currency using the JSTL fmt:formatNumber tag:
However, this doesn't work for showing the value in a Struts 2 textfield.
Another thread, about mixing the struts-html & format tags sounded pretty similar to what I'm trying to do. However, the general consensus was that the best way is to do the formatting in the Action class, so the Struts tag gets an already-formatted String for its value attribute.
While this method works, it's not pretty. I'd prefer to let the UI do the formatting. Is there a better way?