salut j'ai un probleme concernant l'affichage d'une liste d'enregistrements dans une jsp.
voilà ma jsp: Affichecomp.jsp
et voilà la formbean:CompForm
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 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head><title>Liste Compressions</title></head> <body> <table border="2" width="80%" align="center"> <tr><td>Code equip</td><td>Marq</td><td>Type</td><td>Sn Equip</td><td>Vers</td><td>lisence1</td><td>lisence 2</td></tr> <logic:iterate id="comp" name="cf" property="compressions" type="Metier.Compression"> <tr> <td><bean:write name="comp" property="codEquip"/></td> <td><bean:write name="comp" property="marqEquip"/></td> <td><bean:write name="comp" property="typEquip"/></td> <td><bean:write name="comp" property="snEquip"/></td> <td><bean:write name="comp" property="versSE"/></td> <td><bean:write name="comp" property="lisencComprs"/></td> <td><bean:write name="comp" property="lisencCryptag"/></td> </tr> </logic:iterate> </body> </html>
Action form:CompAction
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 package Pres; import java.util.Iterator; import org.apache.struts.action.ActionForm; import Metier.Compression; public class CompForm extends ActionForm{ private Iterator compressions; public Iterator getCompressions() { return compressions; }
et voilà mon fichier struts.config pour etre si clair:
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 package Pres; import java.util.Iterator; 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 Metier.Compression; import Metier.Operation; public class CompAction extends Action { public ActionForward execute( ActionMapping map, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { CompForm compf=(CompForm)form; Operation op=new Operation(); Iterator list=op.listComp().iterator(); compf.setCompressions(list); p.getMarqEquip()+"__"+comp.getTypEquip()); return map.findForward("afficher"); } } public void setCompressions(Iterator compressions) { this.compressions = compressions; } }
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 <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds/struts-config_1_2.dtd"> <struts-config> <form-beans> <form-bean name="cf" type="Pres.CompForm"/> </form-beans> <global-forwards> <forward name="afficher" path="/Vues/Affichecomp.jsp"/> </global-forwards> <action-mappings> <action path="/listcomp" name="cf" type="Pres.CompAction" scope="request" /> </action-mappings> <message-resources parameter="ApplicationResources"/> </struts-config>
voilà le probleme c'est que quand je lance ma page jsp, ça donne aucune erreur, mais elle n'affiche rien, sauf la 1ere ligne du tableau je crois que j'ai une erreur au niveau du logic:iterate.
Ssi vous avez une idée, j'aimerais bien avoir votre solution. Merci d'avance
Partager