是什么决定了JSF版本?容器还是faces-config? [英] what dictates JSF version? Container or faces-config?

查看:152
本文介绍了是什么决定了JSF版本?容器还是faces-config?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在JBoss AS 4.3上运行旧版JSF应用程序.我相信这实现了JSF 1.2.但是,当我查看faces-config时,发现它正在使用JSF 1.1 DTD.

I am currently running a legacy JSF application on JBoss AS 4.3. I believe that this implements JSF 1.2. However, when I looked at the faces-config, I saw that it was using the JSF 1.1 DTD.

我正在使用哪个版本的JSF?

Which version of JSF am I using?

推荐答案

确切的JSF实现版本信息可在JSF实现JAR文件的/META-INF/MANIFEST.MF文件中找到.它通常位于清单文件的底部附近,如下所示:

The exact JSF implementation version information is available in /META-INF/MANIFEST.MF file of the JSF implementation JAR file. It's usually located near the bottom of the manifest file as follows:

Implementation-Title: Mojarra
Implementation-Version: 1.2_12-b01-FCS
Implementation-Vendor: Sun Microsystems, Inc.

可以使用ZIP工具打开JAR文件.如果是Sun RI/Mojarra,文件名是jsf-impl.jar,有时已经在文件名后加上确切的版本号,例如jsf-impl-1.2_12-b01-FCS.jar.如果使用的是JBoss 4.3.x提供的JSF实现,则可以在$JBOSS_HOME/server/<Profile>/deploy/jboss-web.deployer/jsf-libs文件夹中找到该文件.如果您在/WEB-INF/lib中提供了自己的JSF实现并配置了web.xml来告诉JBoss使用它,那么您需要在/WEB-INF/lib中提供的代码中进行检查.

A JAR file can be opened with a ZIP tool. In case of Sun RI / Mojarra, the filename is jsf-impl.jar, sometimes already suffixed with exact version number such as jsf-impl-1.2_12-b01-FCS.jar. If you're using the JSF implementation supplied by JBoss 4.3.x, then you can find the file in $JBOSS_HOME/server/<Profile>/deploy/jboss-web.deployer/jsf-libs folder. If you supplied your own JSF implementation in /WEB-INF/lib and configured web.xml to tell JBoss to use it instead, then you need to check it in the one supplied in /WEB-INF/lib instead.

或者,您可以通过编程方式获取它:

Or, you can just get it programmatically:

Package jsfPackage = FacesContext.class.getPackage();
String implTitle = jsfPackage.getImplementationTitle();
String implVersion = jsfPackage.getImplementationVersion();
String implVendor = jsfPackage.getImplementationVendor();

对于faces-config.xml,您还可以使用它控制应用程序设计的JSF版本.因此,如果您声明它符合JSF 1.1规范,那么即使JSF 1.2/2.0实现也将在JSF 1.1兼容方式"中运行.但是当您实际上使用JSF 1.1实现时,您不能声明它符合JSF 1.2/2.0之类的较新版本.它会出错或被忽略.

As to the faces-config.xml, with it you can also control what JSF version the application is designed for. So if you declared it conform JSF 1.1 spec, then even a JSF 1.2/2.0 implementation will run in JSF 1.1 "compatibility modus". But you cannot declare it conform a newer version like JSF 1.2/2.0 when you're actually using a JSF 1.1 implementation. It will either error out or be ignored.

这篇关于是什么决定了JSF版本?容器还是faces-config?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆