Bonsoir à tous,
Je travail sur un projet avec struts 2 et hibernate, et j'essaie de remplir un combobox avec le résultat d'une requete crée avec Hibernate.
Mon jsp :
Mon fichier action (DeclarerArriveeAction)
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 import="org.apache.tools.ant.taskdefs.Echo"%> <%@ page import="java.sql.*" language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="/WEB-INF/lib/struts-html.tld" prefix="html"%> <%@ taglib uri="/WEB-INF/lib/struts-bean.tld" prefix="bean"%> <!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><bean:message key="title" /></title> <script type="text/javascript" src="../../js/script.js"></script> </head> <body> <jsp:param name="title" value="Ajouter" /> </jsp:include> <div id="corp"><html:errors /> <html:form action="VArriveeAction.do"> <label><bean:message key="label.categ" /></label> <html:select property="categorie"> <html:options collection="listeCategorie" property="categorie" labelProperty="categorie" /> </html:select> </html:form></div> </body> </html>
J'ai cette erreur :
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 public class DeclarerArriveeAction extends Action { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws HibernateException { Session session = HibernateUtil.currentSession(); List listeCategorie = session.find("from Categorie"); Iterator itCategorie = listeCategorie.iterator(); while (itCategorie.hasNext()) { Categorie cat = (Categorie) itCategorie.next(); } HibernateUtil.closeSession(); return mapping.findForward("declarerArriveeFwd"); } }
J'ai regardé sur le forum est il y a apparemment possibilité de résoudre le problème en mettant le tags logic:present, mais il affiche "unknown tag".javax.servlet.jsp.JspException: Cannot find bean under name listeCategorie
Partager