在JSF 2.0应用程序中使用RichFaces 4

Evg*_*rov 5 java jsf richfaces

我正在尝试将RichFaces添加到JSF 2.0应用程序中,但我得到了这个: The requested resource () is not available. 那是来自Console:

java.lang.ClassNotFoundException: org.ajax4jsf.Filter
Run Code Online (Sandbox Code Playgroud)

我的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>RichFaces4Test</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</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>*.jsf</url-pattern>
  </servlet-mapping>


<!-- Plugging the "Blue Sky" skin into the project -->

<context-param>

   <param-name>org.richfaces.SKIN</param-name>

   <param-value>blueSky</param-value>

</context-param>



<!-- Making the RichFaces skin spread to standard HTML controls -->

<context-param>

      <param-name>org.richfaces.CONTROL_SKINNING</param-name>

      <param-value>enable</param-value>

</context-param>



<!-- Defining and mapping the RichFaces filter -->

<filter> 

   <display-name>RichFaces Filter</display-name> 

   <filter-name>richfaces</filter-name> 

   <filter-class>org.ajax4jsf.Filter</filter-class> 

</filter> 



<filter-mapping> 

   <filter-name>richfaces</filter-name> 

   <servlet-name>Faces Servlet</servlet-name>

   <dispatcher>REQUEST</dispatcher>

   <dispatcher>FORWARD</dispatcher>

   <dispatcher>INCLUDE</dispatcher>

</filter-mapping>

</web-app>
Run Code Online (Sandbox Code Playgroud)

我的lib目录:

在此输入图像描述

Bal*_*usC 12

由于RichFaces 4.0你不需要org.ajax4jsf.Filter.这也不再包含在RF 4.0中.请阅读RichFaces 4.0开发者指南,而不是RichFaces 3.x或更早版本的开发者指南.对于RF 4.0,您无需输入任何内容web.xml.只需删除整个<filter><filter-mapping>.

  • 那是一个不同的问题.您最初的问题是关于过滤器上的`ClassNotFoundException`.如果您遇到新问题,请按"提问".评论不是发布新问题/答案的正确位置. (5认同)