I've read various messages and articles that discourage the use of JSTL in
JSF pages, and I think I understand the reasoning behind that. However, I'm hoping that there is a better way to format dates and numbers for display than just returning the formatted
String value from the managed bean.
If I have a person bean, with properties hireDate and salary, I would like person.getHireDate() to return a Date and person.getSalary() to return a float. However, when I'm displaying those properties in a web page, I need them to be formatted into a useful format.
In the JSTL world, I could use <fmt:formatDate> and <fmt:formatNumber>. However, I'm having trouble figuring out how to access those from within a JSF <h:dataTable>.
I supposed I could add person.getFormattedHireDate() and person.getFormattedSalary() to my bean, but that feels wrong (particularly if these values will need to be formatted in different ways at different places).
Here's a (non-working) code snippet:
Is there a good way to do this?
I'm using the latest versions of
JSP, JSTL, and JSF.