Yep:
https://facelets.dev.java.net/nonav/docs/dev/docbook.html#dev-meta-converter
Konstantin Shaposhnikov wrote:
Hello,
I am developing web application using facelets and have problem, that
I do not the best way to solve.
Consider following example:
I have managed bean registered under name "locales" of following class:
Locales {
Locale[] getLocales() {
// return array of some locales
}
}
And have following code in template:
<h:dataTable value="#{locales.locales}" var="locale">
<h:column>
<h:outputText value="#{locale}">
<h:outputText value="#{currentDate}">
<f:convertDateTime locale="#{locale}" dateStyle="long"/>
</h:outputText>
</h:column>
</h:dataTable>
But it just doesn't work neither in JSP nor in facelets. In JSP date
is always displayed formatted in current locale, in facelets exception
is thrown that locale can not be null.
If I understand JSF component model right there is only one
h:outputText component is available in the tree and it can't have
different converters every time it is rendered by t:dataTable.
Facelets version that uses c:forEach instead of h:dataTable works
perfectly, because it creates several components in JSF tree.
Now I see only one solution for this problem: pass expression itself
into converter and reevaluate this expression every time when
conversion is performed. Fortunately I need this behaviour for my
custom converter (not for convertDateTime that I have shown in example
above).
I know how to do it (I mean pass expression instead of object) in JSP,
but I am not sure how it can be done in facelets (I am using it only
for 2 days :). Is it possible to write custom ConvertHandler to do it?
Best regards,
Konstantin
--
http://step-inside.org
--
--------------------------
Sent from my FrankenBerry Wireless Handheld