如何检测当前的JSF版本? [英] How to detect current JSF-Version?
问题描述
我正在开发jsf-webapp,现在我需要知道我使用的是什么JSF版本?我在哪里可以找到这个?预先感谢.
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.
推荐答案
Programmatically, you mean? You can get it from Package#getImplementationVersion()
.
String version = FacesContext.class.getPackage().getImplementationVersion();
还有 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屋!