what dictates JSF version? Container or faces-config?

后端 未结 1 1585
渐次进展
渐次进展 2020-12-18 05:22

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 usin

相关标签:
1条回答
  • 2020-12-18 06:21

    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.

    0 讨论(0)
提交回复
热议问题