views:

205

answers:

2

I am converting a JSP web page to facelets view handler.

What is the equivalent to fmt:formatDate etc.?

I know that it isn't supported. But is there an alternative? A third level implementation?

+2  A: 

Usually in JSF, you would add a (convertDateTime) converter to the control:

<h:outputText value="#{dateConverterBean.now}">
    <f:convertDateTime type="date" dateStyle="short" />
</h:outputText>

The documentation for Facelets implies they use the same.

McDowell
+1  A: 

The f:convertDateTime converter uses GMT / UMT as the time zone for formatting the date/time. This is pretty annoying, and can lead to the incorrect local date and time being displayed. You can supply a time zone to the converter using a bean. I would suggest making your own converter. Only takes a few lines of code and allows more exacting formatting.

Martlark