Question

I use JSF-facelets.jar 1.1.14 (I downloaded it here) and tomcat 6.0

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 1.5.0_12-b04 (Sun Microsystems Inc.)
Implementation-Version: 1.1.14

If I understand well, JSF-facelets.jar = JSF + JSTL + Facelets (???)


My problem is when I use "fmt" fonction.

This code...

  <html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:fmt="http://java.sun.com/jstl/fmt">
       <h:outputLabel value="hello" />
       <fmt:formatDate value="${myBean.date}" pattern="dd/MM/yyyy"/>
  </html>

...generate this HTML code:

  <html>
        <p>hello</p>
        <fmt:formatDate value="${myBean.date}" pattern="dd/MM/yyyy"/>
  </html>



Why "fmt:formatDate" is not change into HTML code ???

Was it helpful?

Solution

The correct way to achieve this in JSF is to use converters. Use the <h:outputText> tag like so:

<h:outputText value="#{myBean.date}">
    <f:convertDateTime pattern="dd/MM/yyyy" />
</h:outputText>

You'll find that not all JSTL tags are supported in JSF. Facelets does provide limited support for the core tag library (forEach, etc) but they might not work the way you expect them to. This article provides a good summary: http://drewdev.blogspot.com/2008/03/build-time-vs-render-time.html

OTHER TIPS

that's a jstl tag. it doesn't need to be translated. it's compiled from a jsp into a servlet.

what did you expect it to be "translated" into?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top