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>