You'll have to look at the archives to find the exact code, but in the
past, there has been code used to detect the difference between JSF
1.1 and 1.0, and possibly 1.2.

Use reflection to find a method that only exists in the later versions.
The standalone facelets library for JSF 1.x did this.

On Fri, Oct 28, 2011 at 4:12 AM, Georg Füchsle <giofy...@googlemail.com> wrote:
> Thanks Kito,
>
> thats great! Now I can control if really the expected jsf.jar is loaded!
>
> Regards,
>
> Georg
>
> 2011/10/27 Kito Mann <kito.m...@virtua.com>:
>> Hello Georg,
>>
>> There isn't a standard API for revealing the JSF version, but you can
>> reveal the location of the JSF API JAR:
>>
>> System.out.println("JSF API Location: "
>> + FacesContext.class.getProtectionDomain().getCodeSource());
>>
>> This will print out the path to the JAR that contains the FacesContext.
>>
>> I've found this useful in WAS 7 and 8 for determining the location of the
>> JSF classes are being loaded.
>> ---
>> Kito D. Mann | twitter: kito99 | Author, JSF in Action
>> Virtua, Inc. | http://www.virtua.com | JSF/Java EE training and consulting
>> http://www.JSFCentral.com - JavaServer Faces FAQ, news, and info | twitter:
>> jsfcentral
>> +1 203-404-4848 x3
>>
>> * Listen to the latest headlines in the JSF and Java EE newscast:
>> http://blogs.jsfcentral.com/roller/editorsdesk/category/JSF+and+Java+EE+Newscast
>> * Keep up with the aftermath of the Oracle/Sun merger:
>> http://www.mergerspeak.com
>>
>>
>>
>> On Thu, Oct 27, 2011 at 6:43 AM, Georg Füchsle 
>> <giofy...@googlemail.com>wrote:
>>
>>> Hallo!
>>>
>>> My WebApp needs to use Jsf with the Version 1.2.15B02. In WAS7 I
>>> achieved this by using shared Libraries. Unfortunately often we forget
>>> to switch on these shared libs. In this case the App runs but on later
>>> sites there will be mistakes due to different cashing of Managed
>>> beans.
>>> Therefore I would like to output the Jsf-Version to a system information
>>> page.
>>> Can anybody show me a function that returns the Jsf-Version?
>>> Gerald once advised me to load special functions that only exist in
>>> the new version of Jsf and to surround this with try-catch-brackets.
>>> If the new function is not loaded, there will be used an older Jsf
>>> version.
>>>
>>> To do this I should find information which functions are new in which
>>> version.
>>> Especially I should recognize if an older version than Jsf1.2-15B02
>>> (mojarra) is used.
>>>
>>> Can anybody give me a link?
>>>
>>> Thanks Georg
>>>
>>
>

Reply via email to