Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what dictates JSF version? Container or faces-config?

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 using the JSF 1.1 DTD.

Which version of JSF am I using?

like image 437
Zack Marrapese Avatar asked Feb 17 '12 14:02

Zack Marrapese


1 Answers

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.

like image 105
BalusC Avatar answered Sep 20 '22 14:09

BalusC