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

Struts 1 Java Discussion :

Error - tag.getAsString : component context is not defined. Check tag syntax


Sujet :

Struts 1 Java

  1. #1
    Nouveau Candidat au Club
    Inscrit en
    Février 2008
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 10
    Points : 1
    Points
    1
    Par défaut Error - tag.getAsString : component context is not defined. Check tag syntax
    Bonjour ,

    Merci d'avance à ceux qui pourront m'aider.

    Je m'appuie sur les exercices du livre De Jean Charles FELICITE Développement Java sous STRUTS 1.2 ,chapitre 6 sur l'utilisation des tiles.

    A l'exécution j'ai le message d'erreur ci-dessous.
    Error - tag.getAsString : component context is not defined. Check tag syntax

    struts-config.xml :
    Code XML : 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
    51
    52
    <?xml version="1.0" encoding="ISO-8859-1" ?>
     
    <!DOCTYPE struts-config PUBLIC
              "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
              "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
     
    <struts-config>    
    <!-- =========================================== Global Forward Definitions -->
        <global-forwards>
            <!-- Default forward to "Welcome" action -->
            <!-- Demonstrates using index.jsp to forward -->
            <forward
                name="welcome"
                path="/Welcome.do"/>
     
            <forward
                name="index"
                path="/index.do"/>
     
        </global-forwards>    
     
     
    <!--  ********************** Mapping *********************** -->   
        <action-mappings>     
                <!-- Default "Welcome" action -->
                <!-- Forwards to Welcome.jsp -->
            <action
                path="/Welcome"
                forward="/pages/Welcome.jsp" />
     
            <action
                path="/index"            
                forward="modele1" />
     
        </action-mappings>
     
        <message-resources parameter="fr.edition.eni.ressources.mesMessages" />
     
        <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        	<set-property
            	property="pathnames"
    	        value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
        	</plug-in>
     
     
        <plug-in className="org.apache.struts.tiles.TilesPlugin"> 
        <set-property property="definitions-config"
    										value="/WEB-INF/tiles-defs.xml" />
        <set-property property="moduleAware" value="true" />
        <set-property property="definitions-parser-validate" value="true" />
       </plug-in>
        </struts-config>
    web.xml :
    Code XML : 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
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    <?xml version="1.0" encoding="ISO-8859-1"?>
     
      <!DOCTYPE web-app PUBLIC
    	"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    	"http://java.sun.com/dtd/web-app_2_3.dtd">
     
    <web-app>
      <display-name>Struts Blank Application</display-name>
     
      <!-- Standard Action Servlet Configuration -->
      <servlet>
        <servlet-name>action</servlet-name>
          <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
        <init-param>
          <param-name>config</param-name>
          <param-value>/WEB-INF/struts-config.xml</param-value>
        </init-param>
        <init-param>
          <param-name>debug</param-name>
          <param-value>2</param-value>
        </init-param>
        <init-param>
          <param-name>detail</param-name>
          <param-value>2</param-value>
        </init-param>
        <init-param>
            <param-name>chainConfig</param-name>
            <param-value>org/apache/struts/tiles/chain-config.xml</param-value>
        </init-param>
     
        <load-on-startup>2</load-on-startup>
     </servlet>
     
     
      <!-- Standard Action Servlet Mapping -->
      <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
      </servlet-mapping>
     
     
      <!-- The Usual Welcome File List -->
      <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>
     
      <!-- Struts Tag Library Descriptors -->
      <taglib>
        <taglib-uri>/tags/struts-bean</taglib-uri>
        <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
      </taglib>
     
      <taglib>
        <taglib-uri>/tags/struts-html</taglib-uri>
        <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
      </taglib>
     
      <taglib>
        <taglib-uri>/tags/struts-logic</taglib-uri>
        <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
      </taglib>
     
      <taglib>
        <taglib-uri>/tags/struts-nested</taglib-uri>
        <taglib-location>/WEB-INF/struts-nested.tld</taglib-location>
      </taglib>
     
      <taglib>
        <taglib-uri>/tags/struts-tiles</taglib-uri>
        <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
      </taglib>
     
      <taglib>
        <taglib-uri>/tags/MesTagsPerso</taglib-uri>
        <taglib-location>/WEB-INF/MesTags.tld</taglib-location>
      </taglib>
    </web-app>
    tiles-defs.xml :
    Code XML : 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
    <?xml version="1.0" encoding="UTF-8" ?>
     
     <!DOCTYPE tiles-definitions PUBLIC
           "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
           "tiles-config_1_1.dtd">
     
     
    <tiles-definitions>
     
        <!-- sample tiles definitions-->
        <definition  name="modele1" path="/index.jsp">
            <put name="titre"  value="Titre de la page principale"/>
            <put name="entete" value="/pages/tiles/entete.jsp" />
            <put name="menu"   value="/pages/tiles/menu.jsp" />
            <put name="pied" value="/pages/tiles/pied.jsp" />
          	<put name="corps"  value="body" /> 
     
        </definition>
        <definition name="modele2" path="/index2.jsp" extends="modele1">
       		<put name="titre"  value="Titre de la page secondaire"/>
       		<put name="corps"  value="body" /> 
        </definition>
     
        <definition name="body" path="/pages/tiles/corps.jsp">
            <put name="liens"  value="/pages/tiles/liens.jsp" />
            <put name="news"  value="/pages/tiles/news.jsp" />
        </definition>
     
        <definition name="body2" path="/pages/tiles/corps.jsp" >
            <put name="liens"  value="/pages/tiles/liens2.jsp" />
            <put name="news"  value="/pages/tiles/news2.jsp" />
        </definition>
     
    </tiles-definitions>
    index.jsp :
    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
    <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
     
    <html>
     
    <head>
    	<title><tiles:getAsString name="titre" ignore="true"/></title>
    </head>
     
    <body>
    <table border="0" width="100%" cellspacing="5">
    <tr>
    <td colspan="2"><tiles:insert attribute="entete" /></td>
    </tr>
    <tr>
    <td width="200" valign="top">
    <tiles:insert attribute="menu"/>
    </td>
    <td valign="top" align="left">
    <tiles:insert attribute="corps" />
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <tiles:insert attribute="pied" />
    </td>
    </tr>
    </table>
    </body>
    </html>

  2. #2
    Membre habitué
    Développeur informatique
    Inscrit en
    Juillet 2007
    Messages
    167
    Détails du profil
    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2007
    Messages : 167
    Points : 143
    Points
    143
    Par défaut
    N'aurais tu pas oublié de declarer ta servlet et de préciser où se trouve le fichier de conf des tiles dans web.xml?

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    <servlet-class>org.apache.struts.tiles.ActionComponentServlet</servlet-class>
        <init-param>
            <param-name>definitions-config</param-name>
            <param-value>/WEB-INF/tileDefinitions.xml</param-value>
        </init-param>
    PS: faute de n'avoir trouvé sur developpez.com, je dirai merci javaworld.com

    PS: Je suis en aucun cas un expert de ce mode de fonctionnement des tiles.

  3. #3
    Nouveau Candidat au Club
    Inscrit en
    Février 2008
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 10
    Points : 1
    Points
    1
    Par défaut erreur tag
    Je débute avec struts et on peut dire que c'est pas si simple
    A priori la définition tiles se fait dans struts-config.xml depuis la version 1.2.

    J'ai quand même essayé mais j'ai toujours un message d'erreur
    je rajoute l'erreur complète.

    StandardWrapperValve[jsp]: "Servlet.service()" pour la servlet jsp a généré une exception
    javax.servlet.ServletException: Error - tag.getAsString : component context is not defined. Check tag syntax
    at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:495)
    at org.apache.jsp.index_jsp._jspService(index_jsp.java:80)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:92)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:162)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)

  4. #4
    Membre habitué
    Développeur informatique
    Inscrit en
    Juillet 2007
    Messages
    167
    Détails du profil
    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2007
    Messages : 167
    Points : 143
    Points
    143
    Par défaut
    je viens de vérifier ton struts-config, ton forward n'est pas bon. Tu dois faire référence à la valeur que tu souhaites afficher de ton tiles-defs.xml. Essaies :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <forward name="index" path="modele1"/>

  5. #5
    Nouveau Candidat au Club
    Inscrit en
    Février 2008
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 10
    Points : 1
    Points
    1
    Par défaut
    Comme ci-dessous.Ca fait toujours la même chose.

    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    <!-- =========================================== Global Forward Definitions -->
        <global-forwards>
            <!-- Default forward to "Welcome" action -->
            <!-- Demonstrates using index.jsp to forward -->
            <forward
                name="welcome"
                path="/Welcome.do"/>
     
    <!--		<forward
                name="index"
                path="/index.do"/>     -->
    		<forward name="index" path="modele1"/>
        </global-forwards>

  6. #6
    Membre habitué
    Développeur informatique
    Inscrit en
    Juillet 2007
    Messages
    167
    Détails du profil
    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2007
    Messages : 167
    Points : 143
    Points
    143
    Par défaut
    dans ton struts config, declares ton fichier de description
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <plug-in className="org.apache.struts.tiles.TilesPlugin">
      <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" /> 
      </plug-in>

  7. #7
    Nouveau Candidat au Club
    Inscrit en
    Février 2008
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 10
    Points : 1
    Points
    1
    Par défaut
    c'est fait .

    ça fait une semaine que je cherche la réponse !
    Est ce que je ne devrais pas passer à une verison struts plus récente ?
    J'ai déjà essayé pas mal de chose

    Je remet mon struts-config.xml complet au cas ou !
    Code xml : 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
    51
    <?xml version="1.0" encoding="ISO-8859-1" ?>
     
    <!DOCTYPE struts-config PUBLIC
              "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
              "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
     
    <struts-config>
        <form-beans>    
            <!-- Declare un javabean de formulaire (stockage du contenu des champs dans forms) -->
     
    <!-- =========================================== Global Forward Definitions -->
        <global-forwards>
            <!-- Default forward to "Welcome" action -->
            <!-- Demonstrates using index.jsp to forward -->
            <forward
                name="welcome"
                path="/Welcome.do"/>
     
     	<forward
                name="index"
                path="/index.do"/>    
     
        </global-forwards> 
     
     
    <!--  ********************** Mapping *********************** -->   
        <action-mappings>     
                <!-- Default "Welcome" action -->
                <!-- Forwards to Welcome.jsp -->
            <action
                path="/Welcome"
                forward="/pages/Welcome.jsp" />
     
            <action
                path="/index"
                type="org.apache.struts.actions.ForwardAction"
                parameter="modele1"/>                        
     
        </action-mappings>
     
     
        <message-resources parameter="fr.edition.eni.ressources.mesMessages" />
     
     
     
     
      <plug-in className="org.apache.struts.tiles.TilesPlugin">
      <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" /> 
      </plug-in>
     
        </struts-config>

  8. #8
    Membre habitué
    Développeur informatique
    Inscrit en
    Juillet 2007
    Messages
    167
    Détails du profil
    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2007
    Messages : 167
    Points : 143
    Points
    143
    Par défaut
    Citation Envoyé par spfab Voir le message
    c'est fait .
    Et est ce que cela marche ?

  9. #9
    Expert éminent

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Points : 7 778
    Points
    7 778
    Par défaut
    Je ne sais pas si ça va corriger ton problème mais dans le struts-config.xml, essaie plutôt de définir le plugin comme ceci :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    <plug-in className="org.apache.struts.tiles.TilesPlugin">
       <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
       <set-property property="definitions-debug" value="0" />
       <set-property property="definitions-parser-details" value="0" />
       <set-property property="definitions-parser-validate" value="false" />
       <set-property property="moduleAware" value="true"/>	
    </plug-in>
    et vu que tu es en Struts 1.2, je pense qu'il faut pointer sur la dtd tiles-config_1_2.dtd dans le tiles-def.xml :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     <!DOCTYPE tiles-definitions PUBLIC
           "-//Apache Software Foundation//DTD Tiles Configuration 1.2//EN"
           "tiles-config_1_2.dtd">
    Sinon, je ne sais pas si c'est une erreur de copier/coller mais dans ton struts-config.xml, il y a une balise form-beans qui n'est pas fermée.

  10. #10
    Nouveau Candidat au Club
    Inscrit en
    Février 2008
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 10
    Points : 1
    Points
    1
    Par défaut
    Non ! il me met toujours le même message (c'est vraiment énervant vu l'investissement que j'y consacre ).Merci de ton aide ..Je vais essayer d'utiliser la version struts 1.3.8 .pour voir si ça fais la même chose ?

  11. #11
    Expert éminent

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Points : 7 778
    Points
    7 778
    Par défaut
    Si tu testes en 1.3.8, jette un oeil aux StrutsUpgradeNotes12to13.

  12. #12
    Nouveau Candidat au Club
    Inscrit en
    Février 2008
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 10
    Points : 1
    Points
    1
    Par défaut
    Bonjour c_nvy ,pour la balise bean c'est bien un copier coller .J'ai essayé ce que tu as proposé.Toujours le même message d'erreur :

    INFO: Server startup in 1484 ms
    19 févr. 2008 21:04:49 org.apache.catalina.core.StandardWrapperValve invoke
    GRAVE: "Servlet.service()" pour la servlet jsp a généré une exception
    javax.servlet.jsp.JspException: Error - tag.getAsString : component context is not defined. Check tag syntax
    at org.apache.struts.taglib.tiles.GetAttributeTag.doEndTag(GetAttributeTag.java:155)
    at org.apache.jsp.index_jsp._jspx_meth_tiles_getAsString_0(org.apache.jsp.index_jsp:121)
    at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:64)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)

  13. #13
    Expert éminent

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Points : 7 778
    Points
    7 778
    Par défaut
    As-tu le même résultat en ajoutant ceci au début de index.jsp :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <tiles:importAttribute scope="request"/>

  14. #14
    Nouveau Candidat au Club
    Inscrit en
    Février 2008
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 10
    Points : 1
    Points
    1
    Par défaut
    J'ai jeté un oeil à l'uri suivante ça n'a pas l'air simple non plus ! StrutsUpgradeNotes12to13.

  15. #15
    Expert éminent

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Points : 7 778
    Points
    7 778
    Par défaut
    As-tu vu ma remarque précédente concernant le importAttribute ?

    Sinon, pour que l'accès à la dtd fonctionne avec la déclaration suivante :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     <!DOCTYPE tiles-definitions PUBLIC
           "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
           "tiles-config_1_1.dtd">
    cela signifie que la dtd existe sous WEB-INF. Est-ce le cas ?

    Si ce n'est pas le cas, il faut plutôt mettre :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     <!DOCTYPE tiles-definitions PUBLIC
           "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
           "http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">
    ou
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     <!DOCTYPE tiles-definitions PUBLIC
           "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
           "http://struts.apache.org/dtds/tiles-config_1_1.dtd">
    D'ailleurs, après vérification, ce que j'ai dit dans un message précédent concernant la dtd est faux car la dtd tiles-config_1_2.dtd n'existe apparemment pas.

  16. #16
    Nouveau Candidat au Club
    Inscrit en
    Février 2008
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 10
    Points : 1
    Points
    1
    Par défaut
    [QUOTE=c_nvy;2969956]J'ai vu ton précédent message mais j'ai tellement changé mes différents fichiers qu'il y a des erreurs un peu partout.Je vais essayer de tout remettre à plat avant d'essayer ce que tu as proposé .Je vais continuer à chercher ... [QUOTE/]

  17. #17
    Nouveau Candidat au Club
    Inscrit en
    Février 2008
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 10
    Points : 1
    Points
    1
    Par défaut
    Citation Envoyé par spfab
    J'ai mise en haut de ma jsp <tiles:importAttribute scope="request"/> j'ai maintenant le message d'erreur ci_dessous:
    INFO: Server startup in 1625 ms
    20 févr. 2008 00:09:10 org.apache.catalina.core.StandardWrapperValve invoke
    GRAVE: "Servlet.service()" pour la servlet jsp a généré une exception
    javax.servlet.jsp.JspException: Error - tag importAttribute : no tiles context found.
    at org.apache.struts.taglib.tiles.ImportAttributeTag.doStartTag(ImportAttributeTag.java:145)
    at org.apache.jsp.index_jsp._jspx_meth_tiles_importAttribute_0(org.apache.jsp.index_jsp:127)
    at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:65)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilter

  18. #18
    Nouveau Candidat au Club
    Inscrit en
    Février 2008
    Messages
    10
    Détails du profil
    Informations forums :
    Inscription : Février 2008
    Messages : 10
    Points : 1
    Points
    1
    Par défaut
    Citation Envoyé par spfab
    Je viens de voir qu'il s'agit peut être d'un bug mais comment puis je faire pour le corriger (ci-dessous ce qu'il en dise) :
    Code xml : 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
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
     DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
    RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
    <http://issues.apache.org/bugzilla/show_bug.cgi?id=30202>.
    ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
    INSERTED IN THE BUG DATABASE.
     
    http://issues.apache.org/bugzilla/show_bug.cgi?id=30202
     
    No exception handling when exposing all request params using ImportAttribute
     
               Summary: No exception handling when exposing all request params
                        using ImportAttribute
               Product: Struts
               Version: 1.1 Final
              Platform: All
            OS/Version: All
                Status: NEW
              Severity: Minor
              Priority: Other
             Component: Tiles framework
            AssignedTo: dev@struts.apache.org
            ReportedBy: peter@finalist.com
     
     
    <tiles:importAttribute /> adds all request parameters from the component 
    context to the page context, however, when a 'null' value is encountered, a 
    NullPointer is thrown from page.Context.setAttribute. This is handled for the 
    named parameter case, like <tile:importAttribute id="id"/> but for some reason 
    this exception handling is not present for the generic case. This results in 
    very nondescriptive error messages.
     
    The code below from ImportAttributeTag fixes this problem.
     
     
    public int doStartTag() throws JspException
        {
          // retrieve component context
        ComponentContext compContext = (ComponentContext)pageContext.getAttribute( 
    ComponentConstants.COMPONENT_CONTEXT, PageContext.REQUEST_SCOPE);
        if( compContext == null )
            throw new JspException ( "Error - tag importAttribute : no tiles 
    context found." );
     
          // set scope
        scope = TagUtils.getScope( scopeName, PageContext.PAGE_SCOPE );
     
          // push attribute in requested context.
        if( name != null )
          {
          Object value = compContext.getAttribute(name);
            // Check if value exist and if we must send a runtime exception
          if( value == null )
            if(!isErrorIgnored)
              throw new JspException ( "Error - tag importAttribute : property '"+ 
    name + "' not found in context. Check tag syntax" );
             else
              return SKIP_BODY;
     
          pageContext.setAttribute(name, value, scope);
          }
         else
          { // set all attributes
          Iterator names = compContext.getAttributeNames();
          while(names.hasNext())
            {
            String name = (String)names.next();
            if(name == null ) {
              if(!isErrorIgnored)
                throw new JspException ( "Error - tag importAttribute : 
    encountered an attribute with key 'null'" );
              else
                return SKIP_BODY;
            }
     
            Object value = compContext.getAttribute(name);
            // Check if value exist and if we must send a runtime exception
            if( value == null ) {
              if(!isErrorIgnored)
                throw new JspException ( "Error - tag importAttribute : 
    property '"+ name + "' has a value of 'null'" );
              else
                return SKIP_BODY;
            }
            pageContext.setAttribute(name, value, scope);
            } // end loop
          } // end if
     
          // Continue processing this page
        return SKIP_BODY;
        }

  19. #19
    Rédacteur
    Avatar de longbeach
    Profil pro
    Architecte de système d’information
    Inscrit en
    Avril 2003
    Messages
    943
    Détails du profil
    Informations personnelles :
    Âge : 49
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Architecte de système d’information

    Informations forums :
    Inscription : Avril 2003
    Messages : 943
    Points : 2 370
    Points
    2 370
    Par défaut
    ok, j'avais exactement le même problème.
    Après avoir cherché pendant 2 heures, voici la solution :

    d'abord il faut savoir que tu ne peux pas attaquer directement la page index.jsp car il n'y a pas encore de context Tile à ce niveau là.

    Donc il faut déjà partir de la page pagePrincipale.jsp car là tu as le tag qui permet d'ajouter un context :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <tiles:insert definition="modele1" flush="true" />
    ça je suppose que tu l'as déjà.
    Ensuite ce qu'il faut savoir c'est que le fichier tiles-def.xml comporte des erreurs de chemin.
    Sinon tu obtiens une page blanche avec absolument aucune erreur visible, l'horreur quoi.
    Je l'ai corrigé.
    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
     
    <?xml version="1.0" encoding="ISO-8859-1" ?>
     
    <!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 1.3//EN"
      "http://struts.apache.org/dtds/tiles-config_1_3.dtd">
     
    <tiles-definitions>
     
    	<!-- sample tiles definitions -->
    	<definition name="modele1" path="/pages/index.jsp">
    		<put name="titre" value="Titre de la page principale" />
    		<put name="entete" value="/pages/tiles/entete.jsp" />
    		<put name="menu" value="/pages/tiles/menu.jsp" />
    		<put name="pied" value="/pages/tiles/pied.jsp" />
    		<put name="corps" value="body" />
    	</definition>
     
    	<definition name="body" path="/pages/corps.jsp">
    		<put name="liens" value="/pages/tiles/liens.jsp" />
    		<put name="news" value="/pages/tiles/news.jsp" />
    	</definition>
     
    </tiles-definitions>
    De rien !

Discussions similaires

  1. "error is not defined"
    Par dreux dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 23/11/2009, 15h22
  2. Error: JAVA_HOME is not defined correctly.
    Par saadoz dans le forum Maven
    Réponses: 5
    Dernier message: 02/03/2009, 23h33
  3. Réponses: 6
    Dernier message: 22/02/2009, 10h41
  4. Réponses: 0
    Dernier message: 05/02/2009, 12h14
  5. [VBA-W] Error! Bookmark not defined
    Par zahui_eric dans le forum VBA Word
    Réponses: 5
    Dernier message: 26/04/2007, 13h25

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