JSF 2.2 组件未在 Spring 和 Maven 上使用 Primefaces 运行 呈现

JSF 2.2 components are not rendered using Primefaces running on Spring and Maven

当我通过 IE11 或 Firefox45 进入 http://localhost:8081/installer/index.xhtml 时,我只看到安装向导,没有看到 JSF 组件。 HTTP 状态代码是 200。我在 Tomcat 7 上没有任何错误。 它是 运行 在 JSF 1.2 上没有问题。我只是不确定 web.xml 文件。

提前致谢。你能告诉我哪里出了问题吗?

已编辑 当我将扩展名从 .xhtml 更改为 .faces 时,我在 Tomcat 输出中得到了一个有用的异常,谢谢。

请检查 web.xml

中的 servlet 映射
<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>/faces/*</url-pattern>
    <url-pattern>*.jsf</url-pattern>
  </servlet-mapping>

现在 url 你 运行 像这里一样调用 servlet 时我会 运行 http://localhost:Port/Path/PageName.jsf 但是当我尝试 运行 http://localhost:Port/Path/PageName.xhtml 它不会工作。或者我必须这样 http://localhost:Port/faces/Path/PageName.xhtml

  • What is the difference between creating .xhtml or .jsp .or .jsf for JSF pages
  • JSF Facelets: Sometimes I see the URL is .jsf and sometimes .xhtml. Why?