JBOSS AS服务器默认使用的JSF实现是SUN的RI,要把他替换成Myfaces需要:
1.移除JBoss的现有的JSF实现RI
修改JBOSS_HOME下的server\<config-name>\deploy\jboss-web.deployer\conf\web.xml文件,把JSF的监听器注掉,并删除jboss-web.deployer 目录下的jsf-libs文件夹
[color=darkred][size=xx-small] <!-- 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>
-->[/size][/color]
2.安装Myfaces的JSF实现
在jboss-web.deployer 目录下新建myfaces-libs文件夹,并把myfaces的实现jar包拷贝到里面
[color=darkred][size=xx-small] commons-beanutils.jar
commons-digester-1.6.jar
commons-el.jar
commons-lang-2.1.jar
myfaces-api.jar
myfaces-impl.jar[/size][/color]
在jboss-web.deployer\conf\web.xml中添加myfaces的监听器
[color=darkred][size=xx-small] <listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>[/size][/color]
3.修改jboss-web.deployer\conf\web.xml中JSF相关的init-param参数,替换
[color=darkred][size=xx-small] <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>[/size][/color]
为
[color=darkred][size=xx-small] <init-param>
<description>MyFaces tlds</description>
<param-name>tagLibJar0</param-name>
<param-value>myfaces-libs/myfaces-impl.jar</param-value>
</init-param>[/size][/color]
现在启动JBOSS AS就可以看到加载的已经加载了Myfaces的JSF。
1.移除JBoss的现有的JSF实现RI
修改JBOSS_HOME下的server\<config-name>\deploy\jboss-web.deployer\conf\web.xml文件,把JSF的监听器注掉,并删除jboss-web.deployer 目录下的jsf-libs文件夹
[color=darkred][size=xx-small] <!-- 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>
-->[/size][/color]
2.安装Myfaces的JSF实现
在jboss-web.deployer 目录下新建myfaces-libs文件夹,并把myfaces的实现jar包拷贝到里面
[color=darkred][size=xx-small] commons-beanutils.jar
commons-digester-1.6.jar
commons-el.jar
commons-lang-2.1.jar
myfaces-api.jar
myfaces-impl.jar[/size][/color]
在jboss-web.deployer\conf\web.xml中添加myfaces的监听器
[color=darkred][size=xx-small] <listener>
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>[/size][/color]
3.修改jboss-web.deployer\conf\web.xml中JSF相关的init-param参数,替换
[color=darkred][size=xx-small] <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>[/size][/color]
为
[color=darkred][size=xx-small] <init-param>
<description>MyFaces tlds</description>
<param-name>tagLibJar0</param-name>
<param-value>myfaces-libs/myfaces-impl.jar</param-value>
</init-param>[/size][/color]
现在启动JBOSS AS就可以看到加载的已经加载了Myfaces的JSF。
JBOSSAS替换JSF实现
本文介绍如何将JBOSSAS服务器默认的SUN JSF实现替换为Myfaces。主要包括移除原有的JSF实现、安装Myfaces并配置其监听器及调整相关参数。
149

被折叠的 条评论
为什么被折叠?



