Access JSF and Primefaces version numbers programmatically

后端 未结 4 460
不知归路
不知归路 2021-01-03 00:52

I use PrimeFaces 3.5.x and Mojarra JSF 2.1.x I would like to access and show the versions of both libraries programmatically.

I use the versions as maven2 properties

4条回答
  •  天涯浪人
    2021-01-03 01:25

    In PrimeFaces 4.0, Constants.VERSION is removed in favor of;

    RequestContext.getCurrentInstance().getApplicationContext().getConfig().getBuildVersion();
    

    Also watch out for FacesContext.class.getPackage().getImplementationVersion();, it doesn't work on some app servers like websphere.

提交回复
热议问题