How to detect current JSF-Version?

后端 未结 3 1337
北荒
北荒 2020-12-01 11:55

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.

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-01 12:43

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

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

    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).

    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.

提交回复
热议问题