What is the cleanest way to display a java.util.Calendar object in JSF?
For others and @seangates: You CAN apply a pattern if using the Calendar object. E.g.
<h:outputText value="#{bean.calendar.time}" styleClass="date">
<f:convertDateTime pattern="EEEE, MMMM d yyyy" />
</h:outputText>
<h:outputText value="#{bean.calendar.time}" styleClass="time">
<f:convertDateTime pattern="hh:mm" />
</h:outputText>
Use Calendar
's own getter Calendar#getTime()
. It returns a Date
. Then you can use <f:convertDateTime>
the usual way.
<h:outputText value="#{bean.calendar.time}">
<f:convertDateTime type="both" dateStyle="long" />
</h:outputText>