bonjour,
je suis entrain de creer une petite application struts.cette application evoque une page qui va lister les erreur:cependant,la balise pb avec <html:errors/> refuse de lister les erreur meme que dans la requette il y a la liste des cles necessaire(que j'arrive a verifier a peine).en plus je suis sure que la tag html fonctionne puisque la blise html:link fonctionne.
voila le code de la page errors.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
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
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.Enumeration"%>
<%@page import="org.apache.struts.action.ActionErrors"%>
<%@page import="org.apache.struts.action.ActionError"%>
<%@page import="java.util.Iterator"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>les erreures</title>
</head>
<body>
<center>
<h2>les erreurs</h2>
</center>
<html:errors />
<%=request.getAttribute("num")%><br />
<%
	for (Enumeration e = request.getAttributeNames(); 
	e.hasMoreElements();
	) {
%>
<%=e.nextElement()%>
<br />
 
<%
	}
%>
 
<br />
<br />
<br />
<%=((ActionErrors) request.getAttribute("org.apache.struts.action.ERROR")).size()%>
<br />
 
<br />
<%=((ActionErrors) request.getAttribute("org.apache.struts.action.ERROR")).get("agevide")%>
<br />
 
<%
	for (Iterator it = ((ActionErrors) request
			.getAttribute("org.apache.struts.action.ERROR"))
			.get("nomvide"); it.hasNext();) {
 
		ActionError er = (ActionError) it.next();
%>
<%=er.getKey()%>
 
 
<br />
 
<%
	}
%>
 
<html:link page="/formulaire.do">
retour formulaire
</html:link>
</body>
</html>
et le fichier struts-config.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
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
 
<form-bean name="frm" type="aymen.Form" />
 
</form-beans>
 
<action-mappings>
<action
path="/main"
name="frm"
scope="session"
validate="true" 
input="/erreur.do"
parameter="/vues/main.html"
type="org.apache.struts.actions.ForwardAction"
/>
<action
path="/erreur"
parameter="/vues/errors.jsp"
type="org.apache.struts.actions.ForwardAction"
/>
<action
path="/reponse"
parameter="/vues/reponse.jsp"
type="org.apache.struts.actions.ForwardAction"
/>
<action
path="/formulaire"
parameter="/vues/formulaire.jsp"
type="org.apache.struts.actions.ForwardAction"
/>
</action-mappings>
<message-resources parameter="ressources.FormRes"/>
</struts-config>