what dictates JSF version? Container or faces-config?

情到浓时终转凉″ 提交于 2019-11-29 07:15:55

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!