IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JSF Java Discussion :

[JSF 2.0] Est-il vraiment possible de se débarrasser de faces-config.xml? Echecs.


Sujet :

JSF Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre très actif

    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    608
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 608
    Par défaut [JSF 2.0] Est-il vraiment possible de se débarrasser de faces-config.xml? Echecs.
    Bonjour,

    En transition JSF 1.2 vers 2.0, je rencontre des difficultés.

    Théoriquement, je dois pouvoir me débarrasser du fichier faces-config.xml devenu optionnel. Dans les faits, je n'y parviens pas.

    Soit je m'y prend de la mauvaise manière, soit une déclaration que j'ai faite en un endroit particulier a fait que je ne suis pas entrain d'utiliser les JSF 2.0 mais les 1.2 et dans ce cas, je ne sais pas comment m'assurer de ce j'ai "en dessous de moi". En tout cas, voici mes symptômes:

    Je transforme un fichier web.xml ainsi:
    Mon fichier web.xml "compatible JSF 1.2":
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
       <servlet>
          <display-name>FacesServlet</display-name>
          <servlet-name>FacesServlet</servlet-name>
          <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
     
          <load-on-startup>1</load-on-startup>
       </servlet>
     
       <servlet-mapping>
          <servlet-name>FacesServlet</servlet-name>
          <url-pattern>/jsf/*</url-pattern>
       </servlet-mapping>
     
       <welcome-file-list>
          <welcome-file>/web/authentification/login/v2/loginV2.jsp</welcome-file>
       </welcome-file-list>
    </web-app>
    est associé à loginV2.jsp qui enclenche FacesServlet et fait un forward à la véritable page d'accueil:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
    <html>
       <head></head>
     
       <body>
          <jsp:forward page="jsf/web/authentification/login/v2/loginVisiteurs.jsp" />
       </body>
    </html>

    Je le transforme en ce web.xml:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
       <servlet>
          <display-name>FacesServlet</display-name>
          <servlet-name>FacesServlet</servlet-name>
          <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
          
          <load-on-startup>1</load-on-startup>
       </servlet>
    
       <servlet-mapping>
          <servlet-name>FacesServlet</servlet-name>
          <url-pattern>*.jsf</url-pattern>
       </servlet-mapping>
    
       <welcome-file-list>
          <welcome-file>/web/authentification/login/v2/loginVisiteurs.jsf[/COLOR]</welcome-file>
       </welcome-file-list>
    </web-app>
    Et je supprime:
    - loginV2.jsp qui faisait le forward auparavant.
    - Le fichier faces-config.xml supposé ne plus être indispensable en JSF 2.0.


    En joignant la page jsf /web/authentification/login/v2/loginVisiteurs.jsf, j'obtiens cette exception:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    [#|2010-04-21T09:38:52.979+0200|WARNING|glassfishv3.0|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=120;_ThreadName=http-thread-pool-8080(4);|ApplicationDispatcher[/SystemeTest] PWC1231: Servlet.service() for servlet Faces Servlet threw exception
    javax.servlet.ServletException: PWC1232: Exceeded maximum depth for nested request dispatches: 20
    	at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:789)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:666)
    	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:499)
    	at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:470)
    	at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:361)
    	at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:318)
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:296)
    	at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:542)
    	at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:355)
    	at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:130)
    	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
    	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1518)
    	at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:804)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:666)
    	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:499)
    	at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:470)
    	at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:361)
    	at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:318)
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:296)
    	at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:542)
    	at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:355)
    	at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:130)
    	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
    	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1518)
    	at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:804)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:666)
    	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:499)
    	at org.apache.catalina.core.ApplicationDispatcher.doDispatch(ApplicationDispatcher.java:470)
    	at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:361)
    	at org.apache.catalina.core.ApplicationDispatcher.dispatch(ApplicationDispatcher.java:318)
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:296)
    	at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:542)
    	at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:355)
    	at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:130)
    	at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
    	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    	at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:313)
    	at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1518)
    	at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:804)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:666)
    	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:499)

    J'ai du mal à l'appréhender.

    En vous remerciant,

    Grunt.

  2. #2
    Rédacteur

    Profil pro
    Inscrit en
    Juin 2003
    Messages
    4 184
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 4 184
    Par défaut
    Quel est le rapport entre le faces-config et les déclarations du web.xml?

    Je ne suis pas sur que JSF 2.0 supporte le code jsp, il faut utiliser seulement le xhtml,
    il y'a dans la faq une autre méthode pour utiliser une page JSF en tant que page d'accueil.

  3. #3
    Membre très actif

    Profil pro
    Inscrit en
    Janvier 2007
    Messages
    608
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2007
    Messages : 608
    Par défaut
    Humm...., j'ai peur que tu n'aies pas tort.

    J'ai une incompréhension manifeste quelque-part.
    J'essaie d'utiliser les JSP, alors que je ne le devrais plus.

    Je suis encore un peu perdu entre les .jsf et les .xhtml que je vois à présent.


    Edit: je vois que le cycle de vie jsf est devenu totalement indépendant de celui des jsp/servlet, et ces deux technologies ne sont plus appelées à se mettre en ménage.

    En revanche, pourquoi JSF n'est-il compatible que Servlet 2.5?
    Les Servlets 3.0 étant compatibles 2.5, comment se fait-il qu'il ne soit pas compatibles 3.0 par transitivité?

Discussions similaires

  1. Réponses: 4
    Dernier message: 08/04/2014, 12h17
  2. Débuter en JSF - Gestion du faces-config.xml
    Par Fred30 dans le forum JSF
    Réponses: 15
    Dernier message: 30/04/2012, 09h14
  3. Eclipse, JSF et faces-config.xml
    Par kohan95 dans le forum Eclipse
    Réponses: 0
    Dernier message: 16/12/2009, 20h34
  4. Réponses: 4
    Dernier message: 24/06/2008, 16h45
  5. Est t il possible d'avoir un menu sur un clic droit ???
    Par almisuifre dans le forum C++Builder
    Réponses: 6
    Dernier message: 21/12/2004, 11h21

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo