Monday, April 23, 2012

How to Print JSF implementation and version

When deploying JSF 2.0 applications in weblogic 10.3.5 first we need to deploy jsf 2.0 as a shared library and refer this library in weblogic.xml file for the application to deploy properly. We use Maven and with maven updating the version of a jar file is easy but when the application is deployed ever wondered which implementation is being used the one in weblogic shared library or jar files from web application class path?

So we decided to show the  JSF implementation and version, Primefaces Version, JPA Version and Build Number information in the footer page similar to what primefaces showcase shows at the bottom of the page.
Below is how you get the details :-)

1. JSF implementation: Returns Mojarra
  public static String getJsfImplementation() {
         return  FacesContext.class.getPackage().getImplementationTitle();
    }
 
2. JSF Version: Returns 2.1.7
  public static String getJsfVersion() {
         return  FacesContext.class.getPackage().getImplementationVersion();
    }

3. Primefaces version: Returns 3.1.1
    public String getPrimefacesVersion(){
        return org.primefaces.util.Constants.VERSION;
    }

4. JPA version: Returns 2.3.0.v20110604-r9504
public String getEclipseLinkVersion() {
        return  org.eclipse.persistence.Version.getVersionString();
    }

No comments:

Post a Comment

PF