如何检测当前的JSF版本?

时间:2012-10-29 16:32:14

标签: jsf version detection

我正在开发一个jsf-webapp,现在我需要知道我正在使用的JSF版本?我在哪里可以看到这个?提前谢谢。

3 个答案:

答案 0 :(得分:43)

以编程方式,你的意思是?你可以从Package#getImplementationVersion()获得它。

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

还有getImplementationVendor()getImplementationTitle()方法。您可能也想使用它来区分供应商(例如,MyFaces或Mojarra)。

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

答案 1 :(得分:1)

对我而言,它没有使用 WebSphere Server ,因此我关注了comment的peater:

System.out.println("JSF API Location: " + FacesContext.class.getProtectionDomain().getCodeSource());
System.out.println("JSF Impl Location: " + Facelet.class.getProtectionDomain().getCodeSource());

它显示了库中文件名的版本:

JSF API位置:(文件:/ C:/workspaces/spielwiese/wlp/dev/api/spec/com.ibm.websphere.javaee。 jsf.2.2_1.0.18 .jar)

JSF Impl位置:(文件:/ C:/workspaces/spielwiese/wlp/dev/api/spec/com.ibm.websphere.javaee。 jsf.2.2_1.0.18 .jar)

答案 2 :(得分:-3)

<强>步骤

1:解压缩javax.faces.jar(解压缩到文件夹),去解压缩     文件夹\ META-INF

2:在META-INF旁边,打开MANIFEST.MF。

3:搜索Implementation-Version

例如:实施版本:2.1.6-SNAPSHOT

相关问题