JSF 版本由什么决定?容器还是面孔配置?

发布于 2025-01-06 09:41:40 字数 125 浏览 3 评论 0原文

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

我使用的是哪个版本的 JSF?

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.

Which version of JSF am I using?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

牵你手 2025-01-13 09:41:40

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

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

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

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

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 等较新版本。它要么出错,要么被忽略。

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.

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();

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文