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 :

struts-config : pb navigation


Sujet :

Struts 1 Java

  1. #1
    Membre éclairé

    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    639
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 639
    Par défaut struts-config : pb navigation
    Bonjour,

    J'ai une index.jsp :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    <html:html>
    	<html:form action="/goToConsultation">
    	<html:submit value="Consultation" ></html:submit>
    	</html:form>
    	<br>
     
    </html:html>
    un 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
        <form-bean
                name="goToConsultationForm"
                type="com.formbean.GoToConsultationForm"/>
        </form-beans>
        <action-mappings>
    		<action
                path="/goToConsultation"
                name="goToConsultationForm"
                type="com.action.GoToConsultation"
                scope="request">
                <forward name="success" path="/private/consultation.jsp" redirect="true"/>
              </action>
        </action-mappings>

    Mais quand je click sur le bouton Consultation j'ai le message d 'erreur suivant :
    type Rapport d'état
    message /medic/goToConsultation
    description La ressource demandée (/medic/goToConsultation) n'est pas disponible.
    Pour info je sécurise mon appli en mettant les pages sous le repertoire private. La sécurité est paramétrée dans 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
    <!-- Gestion de la sécurité -->
    	<security-constraint>
    		<display-name>Authentification avant utilisation</display-name>
    		<web-resource-collection>
    			<web-resource-name>partie protégée de l'application</web-resource-name>
    			<url-pattern>/private/*</url-pattern>
    		</web-resource-collection>
    		<auth-constraint>
    			<role-name>admin</role-name>
    		</auth-constraint>
    	</security-constraint>
    	<security-role>
    		<role-name>admin</role-name>
    	</security-role>
     
    		<!-- Gestion du login -->
    	<login-config>
    		<auth-method>FORM</auth-method>
    		<realm-name>medic</realm-name>
     
    		<!-- Form login = la page de bienvenue et de login, si ca passe alors on est redirigé -->
    		<!-- vers private/index.jsp sinon vers admin/errorLogin-->
    		<form-login-config>
    			<form-login-page>/admin/login.jsp</form-login-page>
    			<form-error-page>/admin/errorlogin.jsp</form-error-page>
    		</form-login-config>
    	</login-config>
    	<welcome-file-list>
    		<welcome-file>private/index.jsp</welcome-file>
    	</welcome-file-list>

    J'arrive bien a la page private/index.jsp, mais en cliquant sur le bouton Consultation, j'ai le message d'erreur.

    Pouvez vous m'aider?
    Merci!

  2. #2
    Expert confirmé

    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
    Par défaut
    Je ne sais pas si ton problème vient de là mais normalement, il y a un ordre à respecter dans les balises du web.xml.
    Mets la balise <welcome-file-list> avant la balise <security-constraint>.

    Sinon, GoToConsultation hérite bien Action ?

  3. #3
    Membre éclairé

    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    639
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 639
    Par défaut
    oui,
    code de l'Action
    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
     
    package com.action;
     
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
     
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
     
    import com.formbean.GoToConsultationForm;
     
    public class GoToConsultation extends Action {
    	public ActionForward execute(ActionMapping mapping,ActionForm form, 
    			HttpServletRequest request, 
    			HttpServletResponse response) throws Exception{
     
    		return mapping.findForward("success");
    	}
    }
    j'ai rajouté
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <servlet-mapping>
        <servlet-name>action</servlet-name>
        <url-pattern>*.do</url-pattern>
      </servlet-mapping>
    dans le Web.xml car il n'y était pas, et depuis j'ai l'erreur :
    type Rapport d'état
    message Servlet action n'est pas disponible.
    description La ressource demandée (Servlet action n'est pas disponible.) n'est pas disponible.
    en mode debuggage je vois qu'il ne va meme pas dans l'Action.

  4. #4
    Expert confirmé

    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
    Par défaut
    Peux-tu montrer le web.xml complet ?

  5. #5
    Membre éclairé

    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    639
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 639
    Par défaut
    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
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4" 
    xmlns="http://java.sun.com/xml/ns/j2ee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    	<display-name>
    	medic</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>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>
     
     
    	<welcome-file-list>
    		<welcome-file>private/index.jsp</welcome-file>
    	</welcome-file-list>
     
    <!-- Gestion de la sécurité -->
    	<security-constraint>
    		<display-name>Authentification avant utilisation</display-name>
    		<web-resource-collection>
    			<web-resource-name>partie protégée de l application</web-resource-name>
    			<url-pattern>/private/*</url-pattern>
    		</web-resource-collection>
    		<auth-constraint>
    			<role-name>admin</role-name>
    		</auth-constraint>
    	</security-constraint>
    	<security-role>
    		<role-name>admin</role-name>
    	</security-role>
     
    		<!-- Gestion du login -->
    	<login-config>
    		<auth-method>FORM</auth-method>
    		<realm-name>medic</realm-name>
     
    		<!-- Form login = la page de bienvenue et de login, si ca passe alors on est redirigé -->
    		<!-- vers private/index.jsp sinon vers admin/errorLogin-->
    		<form-login-config>
    			<form-login-page>/admin/login.jsp</form-login-page>
    			<form-error-page>/admin/errorlogin.jsp</form-error-page>
    		</form-login-config>
    	</login-config>
     
     
     
     
    <jsp-config>
      <taglib>
      	<taglib-uri>/tags/struts-tiles</taglib-uri>
      	<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
      </taglib>
    </jsp-config>	
    </web-app>

  6. #6
    Expert confirmé

    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
    Par défaut
    Et le code du struts-config.xml ?

  7. #7
    Membre éclairé

    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    639
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 639
    Par défaut
    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
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!--
        Licensed to the Apache Software Foundation (ASF) under one or more
        contributor license agreements.  See the NOTICE file distributed with
        this work for additional information regarding copyright ownership.
        The ASF licenses this file to You under the Apache License, Version 2.0
        (the "License"); you may not use this file except in compliance with
        the License.  You may obtain a copy of the License at
     
             http://www.apache.org/licenses/LICENSE-2.0
     
        Unless required by applicable law or agreed to in writing, software
        distributed under the License is distributed on an "AS IS" BASIS,
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        See the License for the specific language governing permissions and
        limitations under the License.
    -->
     
    <!DOCTYPE struts-config PUBLIC
              "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
              "http://struts.apache.org/dtds/struts-config_1_3.dtd">
     
    <!--
         This is a blank Struts configuration file with an example
         welcome action/page and other commented sample elements.
     
         Struts Validator is configured using the factory defaults
         and is ready-to-use.
     
         NOTE: If you have a generator tool to create the corresponding Java classes
         for you, you could include the details in the "form-bean" declarations.
         Otherwise, you would only define the "form-bean" element itself, with the
         corresponding "name" and "type" attributes, as shown here.
    -->
     
     
    <struts-config>
     
        <form-beans>
        <form-bean
                name="goToConsultationForm"
                type="com.formbean.GoToConsultationForm"/>
        </form-beans>
     
    <!-- ========================================= Global Exception Definitions -->
     
        <global-exceptions>
     
        </global-exceptions>
     
     
    <!-- =========================================== Global Forward Definitions -->
     
        <global-forwards>
     
        </global-forwards>
     
     
    <!-- =========================================== Action Mapping Definitions -->
     
        <action-mappings>
    		<action
                path="/goToConsultation"
                name = "goToConsultationForm"
                type="com.action.GoToConsultation"
                scope="request">
                <forward name="success" path="/private/consultation.jsp" redirect="true"/>
              </action>
        </action-mappings>
     
     
    <!-- ======================================== Message Resources Definitions -->
     
        <message-resources parameter="MessageResources" />
     
     
    <!-- =============================================== Plug Ins Configuration -->
     
      <!-- ======================================================= Tiles plugin -->
      <!--
         This plugin initialize Tiles definition factory. This later can takes some
    	 parameters explained here after. The plugin first read parameters from
    	 web.xml, thenoverload them with parameters defined here. All parameters
    	 are optional.
         The plugin should be declared in each struts-config file.
           - definitions-config: (optional)
                Specify configuration file names. There can be several comma
    		    separated file names (default: ?? )
           - moduleAware: (optional - struts1.1)
                Specify if the Tiles definition factory is module aware. If true
                (default), there will be one factory for each Struts module.
    			If false, there will be one common factory for all module. In this
                later case, it is still needed to declare one plugin per module.
                The factory will be initialized with parameters found in the first
                initialized plugin (generally the one associated with the default
                module).
    			  true : One factory per module. (default)
    			  false : one single shared factory for all modules
    	   - definitions-parser-validate: (optional)
    	        Specify if xml parser should validate the Tiles configuration file.
    			  true : validate. DTD should be specified in file header (default)
    			  false : no validation
     
    	  Paths found in Tiles definitions are relative to the main context.
     
          To use this plugin, download and add the Tiles jar to your WEB-INF/lib
          directory then uncomment the plugin definition below.
     
        <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" />
        </plug-in>
      -->  
     
     
      <!-- =================================================== Validator plugin -->
     
      <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        <set-property
            property="pathnames"
            value="/org/apache/struts/validator/validator-rules.xml,
                   /WEB-INF/validation.xml, /WEB-INF/myValidator-rules.xml"/>
      </plug-in>
     
     
        <plug-in className="org.apache.struts.tiles.TilesPlugin">
        	<set-property
            property="definitions-config"
               value="/WEB-INF/tiles-defs.xml"/>
        </plug-in>
     
    <plug-in className="fr.improve.struts.taglib.layout.workflow.LayoutPlugin"/>
     
     
     
     
     
    </struts-config>

  8. #8
    Expert confirmé

    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
    Par défaut
    Vu que tu utilises les Tiles et Struts-Layout, il faut ajouter le controller suivant dans le struts-config.xml entre la balise action-mappings et la balise message-resources :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    <controller processorClass="fr.improve.struts.taglib.layout.workflow.LayoutRequestProcessor"/>

  9. #9
    Membre éclairé

    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    639
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 639
    Par défaut
    en ajoutant cette ligne j'ai un autre problème qui s'ajoute au précédent et qui me genere l'erreur suivante quand je click sur le bouton Consultations :
    javax.servlet.jsp.JspException: Can't get definitions factory from context.
    org.apache.struts.tiles.taglib.InsertTag.processDefinitionName(InsertTag.java:580)
    org.apache.struts.tiles.taglib.InsertTag.createTagHandler(InsertTag.java:479)
    org.apache.struts.tiles.taglib.InsertTag.doStartTag(InsertTag.java:441)
    org.apache.jsp.private_.index_jsp._jspx_meth_tiles_005finsert_005f0(index_jsp.java:78)
    org.apache.jsp.private_.index_jsp._jspService(index_jsp.java:54)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

  10. #10
    Expert confirmé

    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
    Par défaut
    Ce problème, tu l'as déjà eu dans une autre discussion et c'était dû à un problème dans le tiles-def.xml.

    Peux-tu montrer le code complet du tiles-def.xml ?

  11. #11
    Membre éclairé

    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    639
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 639
    Par défaut
    voici le 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
    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
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!--
        $Id: tiles-defs.xml 481833 2006-12-03 17:32:52Z niallp $
     
        Licensed to the Apache Software Foundation (ASF) under one or more
        contributor license agreements.  See the NOTICE file distributed with
        this work for additional information regarding copyright ownership.
        The ASF licenses this file to You under the Apache License, Version 2.0
        (the "License"); you may not use this file except in compliance with
        the License.  You may obtain a copy of the License at
     
             http://www.apache.org/licenses/LICENSE-2.0
     
        Unless required by applicable law or agreed to in writing, software
        distributed under the License is distributed on an "AS IS" BASIS,
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        See the License for the specific language governing permissions and
        limitations under the License.
    -->
     
     <!DOCTYPE tiles-definitions PUBLIC
           "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
           "http://struts.apache.org/dtds/tiles-config_1_1.dtd">
     
    <!-- Definitions for Tiles documentation   -->
     
    <tiles-definitions>
     
      <!-- =======================================================  -->
      <!-- Master definition  									-->
      <!-- =======================================================  -->
     
      <!-- Doc index page description  -->
      <definition name="templateIndex" path="/private/tiles/template.jsp">
      	  <put name="header" value="/private/tiles/header.jsp" />
    	  <put name="menu"   value="/private/tiles/menu.jsp" />
    	  <put name="footer"   value="/private/tiles/footer.jsp" />
    	  <put name="body"   value="body" />
      </definition>
     
      <definition name="templateAccueil" extends="templateIndex">
      	  <put name="body"   value="bodyAccueil" />
      </definition>
      <definition name="templateReferentiel" extends="templateIndex">
      	  <put name="body"   value="bodyReferentiel" />
      </definition>
      <definition name="templatePatients" extends="templateIndex">
      	  <put name="body"   value="bodyPatients" />
      </definition>
      <definition name="templatePlanning" extends="templateIndex">
      	  <put name="body"   value="bodyPlanning" />
      </definition>
     
      <definition name="templateConsultation" extends="templateIndex">
      	  <put name="body"   value="bodyConsultation" />
      </definition>
     
     
      <definition name="body" path="private/index.jsp"/>
      <definition name="bodyAccueil" path="/private/accueil.jsp"/>
      <definition name="bodyReferentiel" path="private/referentiel.jsp"/>
      <definition name="bodyPatients" path="/private/gestionPatients.jsp"/>
      <definition name="bodyPlanning" path="/private/gestionPlanning.jsp"/>
      <definition name="bodyConsultation" path="/private/bodyConsultation.jsp"/>
     
     
     
      <!-- =======================================================  -->
      <!-- Main page body definitions  									-->
      <!-- =======================================================  -->
     
      <definition name="doc.portal.body" path="/layout/columnsLayout.jsp">
        <put name="numCols" value="2" />
        <putList name="list0" >
          <add value="/doc/portal/welcome.jsp" />
          <add value="/doc/portal/features.jsp" />
          <!--<add value="/doc/portal/todo.jsp" /> -->
          <add value="/doc/portal/documentation.jsp" />
        </putList>
        <putList name="list1" >
          <add value="/doc/portal/news.jsp" />
          <add value="/doc/portal/download.jsp" />
          <add value="/doc/portal/tilesCompsTemplates.jsp" />
          <add value="/doc/portal/strutsIntegration.jsp" />
          <add value="/doc/portal/comments.jsp" />
          <add value="/doc/portal/revisions.jsp" />
        </putList>
      </definition>
     
      <!-- =======================================================  -->
      <!-- Menus definitions  									-->
      <!-- =======================================================  -->
     
      <!-- Menu bar definition -->
    <definition name="doc.menu.main" path="/layout/vboxLayout.jsp" >
      <putList name="componentsList" >
        <add value="doc.menu.links" />
        <add value="doc.menu.taglib.references" />
        <add value="doc.menu.printer.friendly" />
        <add value="doc.menu.old.documents" />
      </putList>
    </definition>
     
      <!-- Documentation menu definition v1.1-->
    <definition name="doc.menu.links" path="/layouts/menu.jsp" >
      <put name="title" value="Documentation" />
        <putList name="items" >
          <item value="Home"           link="/index.jsp"  />
          <item value="Live Examples (new)" link="/examples/index.jsp"  />
          <!--
    	  <item> <value>Commented Examples</value> 
    	  		<link>/examples/index.jsp</link>
    			<classtype>org.apache.struts.tiles.beans.SimpleMenuItem</classtype>
    	  </item>
    	  -->
          <item value="Quick overview" link="/doc/quickOverview.jsp"  />
          <!--
          <item value="Tutorial"       link="/doc/tutorial.jsp"  />
          -->
          <item value="Tutorial Live Examples" link="/tutorial/index.jsp" />
          <item value="Download"       link="/doc/download.jsp" />
          <item value="Installation"   link="/doc/installation.jsp" />
          <item value="User Guide"	   link="/doc/userGuide.jsp" />
          <item value="Javadoc"        link="/api/index.html" />
          <item value="Struts Home"    link="http://www.apache.org"   icon="/images/struts-power.gif"        
    			classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />
        </putList>
    </definition>
     
      <!-- Printer friendly menu definition -->
    <definition name="doc.menu.printer.friendly" path="/layouts/menu.jsp" >
      <put name="title" value="Printer Versions" />
      <putList name="items" >
        <item value="Quick Overview"     link="/test/testAll.jsp" />
        <item value="Tutorial"           link="/doc/tutorialBody.html" />
        <item value="User Guide"         link="/doc/userGuideBody.html" />
        <item value="Overview (old)"  	 link="/doc/overviewBody.html" />
      </putList>
    </definition>
     
      <!-- Taglib menu definition -->
    <definition name="doc.menu.taglib.references" path="/layouts/menu.jsp" >
      <put name="title" value="Tag Library Reference" />
        <putList name="items" >
          <item value="Tiles Tags"     link="/doc/tilesTags.jsp" />
          <!-- <item value="Extension Tags (old)"   link="/doc/extensionsTags.jsp" /> -->
        </putList>
    </definition>
     
      <!-- Oldies menu definition -->
    <definition name="doc.menu.old.documents" path="/layouts/menu.jsp" >
      <put name="title" value="Old Documents" />
      <putList name="items" >
        <item value="Overview (old)"     link="/doc/overview.jsp" />
      </putList>
    </definition>
    </tiles-definitions>

  12. #12
    Expert confirmé

    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
    Par défaut
    Si tu utilises toujours Struts 1.3.8, il faut modifier la dtd référencée 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.3//EN"
                  "http://struts.apache.org/dtds/tiles-config_1_3.dtd">
    et tu as oublié un / dans le path du tile body :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
      <definition name="body" path="/private/index.jsp"/>

  13. #13
    Membre éclairé

    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    639
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 639
    Par défaut
    Maintenant je suis retourné au problème initial :
    type Rapport d'état
    message Servlet action n'est pas disponible.
    description La ressource demandée (Servlet action n'est pas disponible.) n'est pas disponible.
    Ce message arrive instantanément apres le click. Donc j'ai l'impression qu'il ne trouve pas l'action mapping dans struts-config.xml.

    Pour info, depuis l'ajout de
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    <controller processorClass="fr.improve.struts.taglib.layout.workflow.LayoutRequestProcessor"/>
    j'ai un message d'erreur au démarrage du serveur :
    javax.servlet.UnavailableException: fr.improve.struts.taglib.layout.workflow.LayoutRequestProcessor
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:402)
    at javax.servlet.GenericServlet.init(GenericServlet.java:212)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:448)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
    Au pire je recommencerai le projet à zéro sans la sécurité, j'ai l'impression qu'il est bloqué à cause de ça.

    Je remets les sources :
    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
    53
    54
    55
    56
    57
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE struts-config PUBLIC
              "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
              "http://struts.apache.org/dtds/struts-config_1_3.dtd">
    <struts-config>
     
        <form-beans>
        <form-bean
                name="goToConsultationForm"
                type="com.formbean.GoToConsultationForm"/>
        </form-beans>
     
    <!-- ========================================= Global Exception Definitions -->
     
        <global-exceptions>
     
        </global-exceptions>
     
     
    <!-- =========================================== Global Forward Definitions -->
     
        <global-forwards>
     
        </global-forwards>
     
     
    <!-- =========================================== Action Mapping Definitions -->
     
        <action-mappings>
    		<action
                path="/goToConsultation"
                name = "goToConsultationForm"
                type="com.action.GoToConsultation"
                scope="request">
                <forward name="success" path="/private/consultation.jsp" redirect="true"/>
              </action>
        </action-mappings>
     
    <controller processorClass="fr.improve.struts.taglib.layout.workflow.LayoutRequestProcessor"/>
     
    <!-- ======================================== Message Resources Definitions -->
     
        <message-resources parameter="MessageResources" />
        <plug-in className="org.apache.struts.tiles.TilesPlugin">
        	<set-property
            property="definitions-config"
               value="/WEB-INF/tiles-defs.xml"/>
        </plug-in>
     
      <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        <set-property
            property="pathnames"
            value="/org/apache/struts/validator/validator-rules.xml,
                   /WEB-INF/validation.xml, /WEB-INF/myValidator-rules.xml"/>
      </plug-in>
      	<plug-in className="fr.improve.struts.taglib.layout.workflow.LayoutPlugin"/>
    </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
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_ID" version="2.4" 
    xmlns="http://java.sun.com/xml/ns/j2ee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    	<display-name>
    	medic</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>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>
     
     
    	<welcome-file-list>
    		<welcome-file>private/index.jsp</welcome-file>
    	</welcome-file-list>
     
    <!-- Gestion de la sécurité -->
    	<security-constraint>
    		<display-name>Authentification avant utilisation</display-name>
    		<web-resource-collection>
    			<web-resource-name>partie protégée de l'application</web-resource-name>
    			<url-pattern>/private/*</url-pattern>
    		</web-resource-collection>
    		<auth-constraint>
    			<role-name>admin</role-name>
    		</auth-constraint>
    	</security-constraint>
    	<security-role>
    		<role-name>admin</role-name>
    	</security-role>
     
    		<!-- Gestion du login -->
    	<login-config>
    		<auth-method>FORM</auth-method>
    		<realm-name>medic</realm-name>
     
    		<!-- Form login = la page de bienvenue et de login, si ca passe alors on est redirigé -->
    		<!-- vers private/index.jsp sinon vers admin/errorLogin-->
    		<form-login-config>
    			<form-login-page>/admin/login.jsp</form-login-page>
    			<form-error-page>/admin/errorlogin.jsp</form-error-page>
    		</form-login-config>
    	</login-config>
     
     
     
     
    <jsp-config>
      <taglib>
      	<taglib-uri>/tags/struts-tiles</taglib-uri>
      	<taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
      </taglib>
    </jsp-config>	
    </web-app>
    Appel de mon action :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
    <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
     
    <html:html>
    	<html:form action="/goToConsultation">
    		<html:submit value="Consultation" ></html:submit>
    	</html:form>
    	<br>
    </html:html>
    Consultation.jsp:
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>
     
    <tiles:insert definition="templateConsultation" flush="true"/>
    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
    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
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    <!DOCTYPE tiles-definitions PUBLIC
                  "-//Apache Software Foundation//DTD Tiles Configuration 1.3//EN"
                  "http://struts.apache.org/dtds/tiles-config_1_3.dtd">
    <!--
        $Id: tiles-defs.xml 481833 2006-12-03 17:32:52Z niallp $
     
        Licensed to the Apache Software Foundation (ASF) under one or more
        contributor license agreements.  See the NOTICE file distributed with
        this work for additional information regarding copyright ownership.
        The ASF licenses this file to You under the Apache License, Version 2.0
        (the "License"); you may not use this file except in compliance with
        the License.  You may obtain a copy of the License at
     
             http://www.apache.org/licenses/LICENSE-2.0
     
        Unless required by applicable law or agreed to in writing, software
        distributed under the License is distributed on an "AS IS" BASIS,
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        See the License for the specific language governing permissions and
        limitations under the License.
    -->
     
     <!DOCTYPE tiles-definitions PUBLIC
           "-//Apache Software Foundation//DTD Tiles Configuration 1.1//EN"
           "http://struts.apache.org/dtds/tiles-config_1_1.dtd">
     
    <!-- Definitions for Tiles documentation   -->
     
    <tiles-definitions>
     
      <!-- =======================================================  -->
      <!-- Master definition  									-->
      <!-- =======================================================  -->
     
      <!-- Doc index page description  -->
      <definition name="templateIndex" path="/private/tiles/template.jsp">
      	  <put name="header" value="/private/tiles/header.jsp" />
    	  <put name="menu"   value="/private/tiles/menu.jsp" />
    	  <put name="footer"   value="/private/tiles/footer.jsp" />
    	  <put name="body"   value="body" />
      </definition>
     
      <definition name="templateAccueil" extends="templateIndex">
      	  <put name="body"   value="bodyAccueil" />
      </definition>
      <definition name="templateReferentiel" extends="templateIndex">
      	  <put name="body"   value="bodyReferentiel" />
      </definition>
      <definition name="templatePatients" extends="templateIndex">
      	  <put name="body"   value="bodyPatients" />
      </definition>
      <definition name="templatePlanning" extends="templateIndex">
      	  <put name="body"   value="bodyPlanning" />
      </definition>
     
      <definition name="templateConsultation" extends="templateIndex">
      	  <put name="body"   value="bodyConsultation" />
      </definition>
     
     
      <definition name="body" path="/private/index.jsp"/>
      <definition name="bodyAccueil" path="/private/accueil.jsp"/>
      <definition name="bodyReferentiel" path="/private/referentiel.jsp"/>
      <definition name="bodyPatients" path="/private/gestionPatients.jsp"/>
      <definition name="bodyPlanning" path="/private/gestionPlanning.jsp"/>
      <definition name="bodyConsultation" path="/private/bodyConsultation.jsp"/>
     
     
     
      <!-- =======================================================  -->
      <!-- Main page body definitions  									-->
      <!-- =======================================================  -->
     
      <definition name="doc.portal.body" path="/layout/columnsLayout.jsp">
        <put name="numCols" value="2" />
        <putList name="list0" >
          <add value="/doc/portal/welcome.jsp" />
          <add value="/doc/portal/features.jsp" />
          <!--<add value="/doc/portal/todo.jsp" /> -->
          <add value="/doc/portal/documentation.jsp" />
        </putList>
        <putList name="list1" >
          <add value="/doc/portal/news.jsp" />
          <add value="/doc/portal/download.jsp" />
          <add value="/doc/portal/tilesCompsTemplates.jsp" />
          <add value="/doc/portal/strutsIntegration.jsp" />
          <add value="/doc/portal/comments.jsp" />
          <add value="/doc/portal/revisions.jsp" />
        </putList>
      </definition>
     
      <!-- =======================================================  -->
      <!-- Menus definitions  									-->
      <!-- =======================================================  -->
     
      <!-- Menu bar definition -->
    <definition name="doc.menu.main" path="/layout/vboxLayout.jsp" >
      <putList name="componentsList" >
        <add value="doc.menu.links" />
        <add value="doc.menu.taglib.references" />
        <add value="doc.menu.printer.friendly" />
        <add value="doc.menu.old.documents" />
      </putList>
    </definition>
     
      <!-- Documentation menu definition v1.1-->
    <definition name="doc.menu.links" path="/layouts/menu.jsp" >
      <put name="title" value="Documentation" />
        <putList name="items" >
          <item value="Home"           link="/index.jsp"  />
          <item value="Live Examples (new)" link="/examples/index.jsp"  />
          <!--
    	  <item> <value>Commented Examples</value> 
    	  		<link>/examples/index.jsp</link>
    			<classtype>org.apache.struts.tiles.beans.SimpleMenuItem</classtype>
    	  </item>
    	  -->
          <item value="Quick overview" link="/doc/quickOverview.jsp"  />
          <!--
          <item value="Tutorial"       link="/doc/tutorial.jsp"  />
          -->
          <item value="Tutorial Live Examples" link="/tutorial/index.jsp" />
          <item value="Download"       link="/doc/download.jsp" />
          <item value="Installation"   link="/doc/installation.jsp" />
          <item value="User Guide"	   link="/doc/userGuide.jsp" />
          <item value="Javadoc"        link="/api/index.html" />
          <item value="Struts Home"    link="http://www.apache.org"   icon="/images/struts-power.gif"        
    			classtype="org.apache.struts.tiles.beans.SimpleMenuItem" />
        </putList>
    </definition>
     
      <!-- Printer friendly menu definition -->
    <definition name="doc.menu.printer.friendly" path="/layouts/menu.jsp" >
      <put name="title" value="Printer Versions" />
      <putList name="items" >
        <item value="Quick Overview"     link="/test/testAll.jsp" />
        <item value="Tutorial"           link="/doc/tutorialBody.html" />
        <item value="User Guide"         link="/doc/userGuideBody.html" />
        <item value="Overview (old)"  	 link="/doc/overviewBody.html" />
      </putList>
    </definition>
     
      <!-- Taglib menu definition -->
    <definition name="doc.menu.taglib.references" path="/layouts/menu.jsp" >
      <put name="title" value="Tag Library Reference" />
        <putList name="items" >
          <item value="Tiles Tags"     link="/doc/tilesTags.jsp" />
          <!-- <item value="Extension Tags (old)"   link="/doc/extensionsTags.jsp" /> -->
        </putList>
    </definition>
     
      <!-- Oldies menu definition -->
    <definition name="doc.menu.old.documents" path="/layouts/menu.jsp" >
      <put name="title" value="Old Documents" />
      <putList name="items" >
        <item value="Overview (old)"     link="/doc/overview.jsp" />
      </putList>
    </definition>
     
     
    </tiles-definitions>

    Arborescence du projet :
    Pièce jointe 37388

  14. #14
    Expert confirmé

    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
    Par défaut
    Attention, tu as laissé le doctype qui pointe sur la 1.1 dans le tiles-def.xml et tu as enlevé la balise xml.

  15. #15
    Membre éclairé

    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    639
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2004
    Messages : 639
    Par défaut
    Ça ne change rien, je vais recommencer à zéro, j'ai dû louper quelque chose au début!
    Merci.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [Struts] [Tomcat] problème struts-config
    Par danyboy85 dans le forum Tomcat et TomEE
    Réponses: 7
    Dernier message: 10/02/2006, 14h50
  2. [Struts] Problème avec struts-config.xml
    Par The_freeman dans le forum Struts 1
    Réponses: 6
    Dernier message: 29/01/2006, 22h55
  3. [ Sruts ] [xdoclet] Génération du struts-config.xml
    Par acheda dans le forum Struts 1
    Réponses: 7
    Dernier message: 03/03/2005, 09h45
  4. [Struts][struts-config.xml] question sur l element action
    Par SEMPERE Benjamin dans le forum Struts 1
    Réponses: 3
    Dernier message: 08/10/2004, 16h25
  5. [struts]: struts-config.xml
    Par sleepy2002 dans le forum Struts 1
    Réponses: 2
    Dernier message: 01/10/2004, 10h32

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