Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How could I check the version of JSF  RSS feed

 
Santosh Ganapa
Ranch Hand
Posts: 32
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I have joined a new project which makes use of jsf. There are 8+ applications, so I am wondering on how to check the version of JSF used in them?
 
Roger Sterling
Ranch Hand
Posts: 426
Eclipse IDE Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Note that since JSF is integrated into JEE servers, unless the WAR overrides it, the JSF version in use is determined by the server, not the web application.

Unfortunately, I don't really know a good way to check the JSF version required to properly run a webapp. In theory, the schema version of the faces-config.xml file would do it, but it's not a reliable indicator.
 
Santosh Ganapa
Ranch Hand
Posts: 32
Eclipse IDE Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following lines of code helped me!

FacesContext.class.getPackage().getImplementationVersion()
FacesContext.class.getPackage().getImplementationVendor()
FacesContext.class.getPackage().getImplementationTitle()
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that the APIs you are using will fetch that info from the jar file's MANIFEST.MF which may or may not have all that relevant information. It all depends on how the jar was built.
 
Dieter Quickfend
Bartender
Posts: 543
4
Java Netbeans IDE Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your project follows good practice, it will be specified in the project POM or parent POM.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dieter Quickfend wrote:If your project follows good practice, it will be specified in the project POM or parent POM.

In the case of JSF, those libraries are marked as provided (almost always) and are provided by the container. So even though at build time you might know the version you are compiling against, the exact version on the server might not always be the same.
 
Dieter Quickfend
Bartender
Posts: 543
4
Java Netbeans IDE Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jaikiran Pai wrote:In the case of JSF, those libraries are marked as provided (almost always) and are provided by the container. So even though at build time you might know the version you are compiling against, the exact version on the server might not always be the same.

You're right, of course. I hadn't thought about that.
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cogent points. You can tell what version the webapps require as a minimum by what version of the JSF-API jar they build from, but the actual server could have something more recent. However, it probably doesn't matter, since the API wouldn't have access to newer features.

All of which is worth considering, but the actual question was posed 2 months ago. I'm not sure if it's of more than academic interest by now as far as the original need went.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!