2014-01-31 56 views
1

这里是我的代码为什么我的功能没有找到?

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

当我运行它,我得到这个错误:

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

这里是我的的pom.xml

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

这里是我的网.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> 
+0

你有'''命名空间集? –

+0

@kocko是的我有 – Stephan

+1

您确定Omnifaces库位于类路径中吗?你可以尝试运行'mvn clean install'吗? –

回答

2

可能Omnifaces lib尚未添加到类路径中。

mvn clean install应该这样做。

+2

事实上,Eclipse完全忽略了Maven库。我必须通过执行** Project Properties **> Deployment Assembly来添加它们,然后添加Maven库。 – Stephan