Problème de logic:iterate
Bonjour,
je travaille actuellement sur un projet visant à créer une application web à l'aide de Struts.
J'ai actuellement un problème pour l'affichage d'une liste d'application.
Voici l'erreur que je rencontre :
Code:
Cannot create iterator for this collection
Le code de mon action :
Code:
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
| package controler.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import model.Application;
import model.Applitheque;
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 sauvegarde.SauvegarderApplitheque;
import controler.actionform.ApplithequeForm;
public class ListeAppliAdmin extends Action{
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request,javax.servlet.http.HttpServletResponse response)
throws Exception{
ApplithequeForm applithequeform = null;
HttpSession session = request.getSession(true);
applithequeform = (ApplithequeForm) session.getAttribute("applithequeform");
if (applithequeform == null){
//On créé le bean et on l'enregistre
applithequeform = new ApplithequeForm();
applithequeform.setApplitheque(SauvegarderApplitheque.lire(getServlet().getServletContext().getRealPath("/sauvegardes/applitheque.xml")));
System.out.println(applithequeform);
session.setAttribute("applithequeform", applithequeform);
}
return mapping.findForward("listeAppliAdmin");
}
} |
Ma JSP :
Code:
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
| <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="logic" uri="http://struts.apache.org/tags-logic" %>
<%@ taglib prefix="bean" uri="http://struts.apache.org/tags-bean" %>
<%@ taglib prefix="html" uri="http://struts.apache.org/tags-html" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Applithèque</title>
</head>
<body>
<h1>Applithèque</h1><br/>
<table border = "1">
<thead>
<tr>
<td>Nom</td>
<td>Résumé</td>
<td>Langue</td>
<td>Licence</td>
<td>Version</td>
<td>Lien</td>
<td>Note</td>
<td>Modifier</td>
<td>Supprimer</td>
</tr>
</thead>
<tbody>
<logic:notEmpty name="applithequeform" property="applitheque">
<logic:iterate id="appli" name="applithequeform" property="applitheque" >
<tr>
<td>
<html:link action="detailAppliAdmin.do" paramName="appli" paramProperty="id" paramId="id">
<bean:write name="appli" property="nom"/></html:link>
</td>
<td><bean:write name="appli" property="resume"/></td>
<td><bean:write name="appli" property="langue"/></td>
<td><bean:write name="appli" property="licence"/></td>
<td><bean:write name="appli" property="version"/></td>
<td><a href="<bean:write name='appli' property='lien'/>"><bean:write name='application' property='lien'/></a></td>
<td><bean:write name="appli" property="note"/></td>
<td align="center">
<html:link action="modifApplication.do" paramName="appli" paramProperty="id" paramId="id">
X
</html:link>
</td>
<td align="center">
<html:link action="supprApplication.do" paramName="appli" paramProperty="id" paramId="id">
X
</html:link>
</td>
</tr>
</logic:iterate>
</logic:notEmpty>
</tbody>
</table>
<br /><br />Ajout d'une application :<br /><br />
<form method="POST" action="ajoutApplication.do">
<table>
<tr><td>Nom : </td><td><input type="text" name="nom" value="" /></td></tr>
<tr><td>Résumé : </td><td><input type="text" name="resume" value="" /></td></tr>
<tr><td>Langue : </td><td><input type="text" name="langue" value="" /></td></tr>
<tr><td>Licence : </td><td><input type="text" name="licence" value="" /></td></tr>
<tr><td>Version : </td><td><input type="text" name="version" value="" /></td></tr>
<tr><td>Lien : </td><td><input type="text" name="lien" /></td></tr>
<tr><td colspan="2"><input type="submit" name="btn_valider_appli" value="Valider" />
</table>
</form>
<br />
<html:link action="listeAdmin.do">Gestion des admininstrateurs</html:link><br /><br />
</body>
</html> |
J'ai un type application et une arrayList de ces applications. (Avec tous les getters et setters qui vont). J'ai checké tout ce qui était checkable mais je ne pas trouvé d'où cette erreur vient.
Auriez vous une petite idée ? Merci d'avance.