在JBOSS服務(wù)器上使用Myfaces的JSF實現(xiàn)
JBOSS AS服務(wù)器默認(rèn)使用的JSF實現(xiàn)是SUN的RI,要把他替換成Myfaces需要:
1.移除JBoss服務(wù)器的現(xiàn)有的JSF實現(xiàn)RI
修改JBOSS_HOME下的server\< config-name>\deploy\jboss-web.deployer\conf\web.xml文件,把JSF的監(jiān)聽器注掉,并刪除jboss-web.deployer 目錄下的jsf-libs文件夾
- < !-- Comment/Remove this -->
- < !-- Configures JSF for a web application if the javax.faces.webapp.FacesServlet is declared -->
- < !-- in web.xml. -->
- < !--
- < listener>
- < listener-class>org.jboss.web.jsf.integration.config.JBossJSFConfigureListener< /listener-class>
- < /listener>
- -->
- < !-- Comment/Remove this -->
- < !-- Listens to all web app lifecycle events so that @PreDestroy can be called on -->
- < !-- JSF managed beans that go out of scope. You can comment this out if you -->
- < !-- don't use JSF or you don't use annotations on your managed beans. -->
- < !--
- < listener>
- < listener-class>com.sun.faces.application.WebappLifecycleListener< /listener-class>
- < /listener>
- -->
2.安裝Myfaces的JSF實現(xiàn)
在jboss-web.deployer 目錄下新建myfaces-libs文件夾,并把myfaces的實現(xiàn)jar包拷貝到里面
- commons-beanutils.jar
- commons-digester-1.6.jar
- commons-el.jar
- commons-lang-2.1.jar
- myfaces-api.jar
- myfaces-impl.jar
在jboss-web.deployer\conf\web.xml中添加myfaces的監(jiān)聽器
- < listener>
- < listener-class>org.apache.myfaces.webapp.StartupServletContextListener< /listener-class>
- < /listener>
3.修改jboss-web.deployer\conf\web.xml中JSF相關(guān)的init-param參數(shù),替換
- < init-param>
- < description>JSF standard tlds< /description>
- < param-name>tagLibJar0< /param-name>
- < param-value>jsf-libs/jsf-impl.jar< /param-value>
- < /init-param>
- < init-param>
- < description>JSTL standard tlds< /description>
- < param-name>tagLibJar1< /param-name>
- < param-value>jstl.jar< /param-value>
- < /init-param>
為
- < init-param>
- < description>MyFaces tlds< /description>
- < param-name>tagLibJar0< /param-name>
- < param-value>myfaces-libs/myfaces-impl.jar< /param-value>
- < /init-param>
現(xiàn)在啟動JBOSS AS就可以看到加載的已經(jīng)加載了Myfaces的JSF??梢栽贘BOSS服務(wù)器上使用Myfaces的JSF實現(xiàn)了。
【編輯推薦】