Question

Here is my code

<html (...) xmlns:of="http://omnifaces.org/functions">
 ...
<c:set var="formattedDate"
    value="#{of:formatDate(now, 'dd/MM/yyyy')}" />

When I run it, I get this error:

value="#{of:formatDate(now, 'dd/MM/yyyy')}" Function 'of:formatDate' not found
javax.faces.webapp.FacesServlet.service(FacesServlet.java:606)

Here is my pom.xml

...
<dependency>
    <groupId>org.omnifaces</groupId>
    <artifactId>omnifaces</artifactId>
    <version>1.7</version>
</dependency>

Here is my web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>JSFPlayground</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.xhtml</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>
</web-app>
Was it helpful?

Solution

Possibly the Omnifaces lib has not been added to the classpath.

mvn clean install should do the trick.

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