【问题标题】:PrimeFaces doesn't workPrimeFaces 不起作用
【发布时间】:2013-07-23 20:53:45
【问题描述】:

我的 NewFile.xhtml 有问题。我使用 jsf2.2

当我将库 primefaces-3.5.jar 放入我的 web/lib 文件夹并重新启动 tomcat 服务器时,网页不再工作。当我删除我的 PrimeFaces jar 文件时,一切正常,但不显示我的 PrimeFaces 标签。

我把外部jar放对了,但是我觉得有问题:

我的 web.xml 文件

  <!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >
 <web-app>
<display-name>Sample JSF 2 Filter login app</display-name>

<!-- Login filter -->
<filter>
    <filter-name>LoginFilter</filter-name>
    <filter-class>somePackage.LoginFilter</filter-class>
</filter>
<!-- Set the login filter to secure all the pages in the /secured/* path of the   application  -->



<!-- Staring JSF -->
<servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>

<!-- JSF URL mapping -->
<servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
</servlet-mapping>

   <!-- By default go to secured welcome page -->
   <welcome-file-list>
    <welcome-file>NewFile.xhtml</welcome-file>
   </welcome-file-list>

    </web-app>

我的 NewFile.xhtml :

 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">

     <h:head>
        </h:head>
       <h:body>
<h1>Hello World PrimeFaces</h1>

<h:form>
   <p:editor value="#{editor.value}" />
</h:form>

       </h:body>
      </html>

【问题讨论】:

  • 日志文件中有什么相关的吗?
  • 不,日志中没有出现任何错误
  • 只是:HTTP 状态 404 - /jsf-blank/NewFile.xhtml,但是在删除 primfaces jar 文件时它会起作用! .

标签: jsf-2 primefaces


【解决方案1】:

正如this post 所建议的那样,Primefaces 3.5 不支持 JSF 2.2,从 4.0 开始已经支持。 您应该考虑切换到最新的 Primefaces 版本。

阅读文档了解更多详情:Primefaces User's Guide 3.5

【讨论】:

  • 很好,删除了我的评论
猜你喜欢
  • 2014-11-06
  • 2015-10-08
  • 2014-04-30
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-04-10
  • 2012-10-01
相关资源
最近更新 更多