Re: Re: JSF2.0 + Jonas 5.1.2

Patrick Reignier <[email protected]>
Newsgroups gmane.comp.java.objectweb.jonas
Message-ID <[email protected]>
Hello Guillaume

I was missing step 4 (jonas-web.xml)
It now works

Thank you very much for you help and your reactivity

Best



On 09/23/2010 06:23 PM, Guillaume Sauthier wrote:
> Hi Patrick
>
> Indeed, JSF 2.0 do not work out of the box with JOnAS 5.x.
> JOnAS 5.x is Java EE 5 compliant and JSF 2 is part of Java EE 6.
>
> Anyway, it's still possible to use JSF 2.0 withing JOnAS 5.x.
> Here how to do that:
>
> 1. Ensure that your web.xml has the 'version' attribute set to 2.5 
> (JSF 2 mandates Servlet 2.5)
> 2. Declares your Faces Servlet and maps *.jsf paths to it
>
>   1.
>       <servlet>
>   2.
>       <servlet-name>Faces Servlet</servlet-name>
>   3.
>       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>   4.
>       </servlet>
>   5.
>   6.
>       <servlet-mapping>
>   7.
>       <servlet-name>Faces Servlet</servlet-name>
>   8.
>       <url-pattern>*.jsf</url-pattern>
>   9.
>       </servlet-mapping>
>
>
> 3. Also ensure that your faces-config.xml 'version' attribute is set 
> to 2.0 (See example of a minimum file below)
> <faces-config xmlns="http://java.sun.com/xml/ns/javaee"
>        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>        http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
>        version="2.0">
> </faces-config>
>    
> 4. You also have to tweak the ClassLoader to ensure that you will use 
> the JSF API and implementation that you have in your webapp. This can 
> be done using the WEB-INF/jonas-web.xml
> <jonas-web-app xmlns="http://www.objectweb.org/jonas/ns"
>                 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>                 xsi:schemaLocation="http://www.objectweb.org/jonas/ns
>                 http://www.objectweb.org/jonas/ns/jonas-web-app_4_0.xsd">
>        <java2-delegation-model>false</java2-delegation-model>
> </jonas-web-app>
>
> 4.b Note that you can achieve the same result by filtering javax.faces.* package using the conf/filtering-default-classloader.xml
>
> 5. Then your XHTML files should looks like:
> <html xmlns="http://www.w3.org/1999/xhtml"
>        xmlns:h="http://java.sun.com/jsf/html"
>        xmlns:f="http://java.sun.com/jsf/core"
>        xmlns:ui="http://java.sun.com/jsf/facelets">
>
> 6. Do not forget to embed the JSF 2.0 API+Implementation jars in your WEB-INF/lib
>
>    
> Notice that only the step #4 is specific to JOnAS.
>
> Hope this helps....
>
> Cheers
> --Guillaume
>
> Le 23/09/2010 16:50, Patrick Reignier a écrit :
>> Hello
>>
>> I could not succeed using Jonas 5.1.2 with JSF 2.0 (mojarra)
>>
>> I have made a minimal example. This example starts directly using
>> mvn tomcat: run
>>
>> When deployed on Jonas, the first concern is that the
>> tomcat on jonas considers that the default page language description 
>> is jsp
>> (JSF 1.2 behavior and not JSF2.0). By adding the lines
>>
>> <context-param>
>> <param-name> javax.faces.DEFAULT_SUFFIX </ param-name>
>> <param-value>. xhtml </ param-value>
>> </ Context-param>
>>
>> in the web.xml, this fixes the problem but then nothing happens:
>> index.jsf page is loaded but is left intact by the JSF servlet
>>  (a "view source" in the browser shows all the JSF tags still in the 
>> page).
>>
>> The example  is here
>> http://www-prima.inrialpes.fr/reignier/test.tar.gz
>>
>> Thank you
Patrick_Reignier.vcf (text/x-vcard, 268 B)
begin:vcard
fn:Patrick Reignier
n:Reignier;Patrick
org:LIG ;PRIMA
adr:;;655 Avenue de l'Europe;Montbonnot;;;France
email;internet:[email protected]
title:Associate Professor
tel;work:+33 476 615 411
url:http://www-prima.inrialpes.fr
version:2.1
end:vcard
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.