如何检测当前的 JSF 版本? [英] How to detect current JSF-Version?

查看:17
本文介绍了如何检测当前的 JSF 版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 jsf-webapp,现在我需要知道我使用的是什么 JSF-Version?我在哪里可以查到这个?提前致谢.

I am developing a jsf-webapp and now I need to know what JSF-Version I am using? Where can I look this up? Thanks in advance.

推荐答案

您是说以编程方式?您可以从 Package#getImplementationVersion().

Programmatically, you mean? You can get it from Package#getImplementationVersion().

String version = FacesContext.class.getPackage().getImplementationVersion();

顺便说一下还有getImplementationVendor()getImplementationTitle() 方法.您可能还想使用它来区分供应商(例如 MyFaces 或 Mojarra).

There are by the way also getImplementationVendor() and getImplementationTitle() methods. You might want to use it as well in order to distinguish the vendor (MyFaces or Mojarra, for example).

或者你的意思是手动?只需查看 JSF impl JAR 文件的 /META-INF/MANIFEST.MF 文件即可.您可以使用 ZIP 工具提取 JAR 文件.它是清单文件的 Implementation-Version 条目.

Or do you mean manually? Just look in /META-INF/MANIFEST.MF file of the JSF impl JAR file. You can extract the JAR file with a ZIP tool. It's the Implementation-Version entry of the manifest file.

这篇关于如何检测当前的 JSF 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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