如何在GlassF作为服务器的JSF项目中使用Pretty Faces?

时间:2013-06-21 11:56:19

标签: jsf

我尝试在我的jsf项目中使用PrettyFaces,但在部署我的项目时遇到了错误。 多数民众赞成我所做的: 我把它添加到我的web.xml:

    <filter>
   <filter-name>Pretty Filter</filter-name>
   <filter-class>com.ocpsoft.pretty.PrettyFilter</filter-class>
    </filter>

    <filter-mapping> 
       <filter-name>Pretty Filter</filter-name> 
       <url-pattern>/*</url-pattern> 
       <dispatcher>FORWARD</dispatcher> 
       <dispatcher>REQUEST</dispatcher> 
       <dispatcher>ERROR</dispatcher>
    </filter-mapping>

我在web inf中创建了pretty-config.wml:

<pretty-config xmlns="http://ocpsoft.com/prettyfaces/3.3.0" 
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
               xsi:schemaLocation="http://ocpsoft.com/prettyfaces/3.3.0
                                        http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.3.0.xsd">

      <url-mapping> 
          <pattern value="/" /> 
          <view-id value="/faces/*" />
      </url-mapping> 

</pretty-config>

我将Prettyfaces的jar添加到libs

  

prettyfaces-jsf2-3.3.0来源

但是当我部署我的项目时,我得到了这个错误:

deploy?DEFAULT=C:\Users\hp\Documents\NetBeansProjects\PlanificationDrapage\dist\gfdeploy\PlanificationDrapage&name=PlanificationDrapage&force=true failed on GlassFish Server 3+ 
 Error occurred during deployment: Exception while loading the app : java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: java.lang.ClassNotFoundException: com.ocpsoft.pretty.faces.config.PrettyConfigListener. Please see server.log for more details.
C:\Users\hp\Documents\NetBeansProjects\PlanificationDrapage\nbproject\build-impl.xml:294: The module has not been deployed.

我正在使用带有玻璃鱼的netbeans。 更新: 我解决了使用坏罐子造成的第一个问题。

没有我在Pretty-config.xhtml为空时集成和工作Prettyfaces但是当我运行我的项目时我添加此代码我没有错误但我白页。

这就是我添加的内容:

<url-mapping id="accueil"> 
    <pattern value="/" /> 
       <view-id value="/admin/adminHome.xhtml" />             
    </url-mapping>

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

你要包括prettyfaces-jsf2-3.3.0-sources(Prettyfaces的来源)你必须包含二进制jar。从这里例如:
http://mvnrepository.com/artifact/com.ocpsoft
或者从这里开始 http://grepcode.com/snapshot/repo1.maven.org/maven2/com.ocpsoft/prettyfaces-jsf2/3.3.0/