Salut,
j ai un problème qd je veux afficher des données de ma DB.
Ma JSP:
Mon controleur
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 <%@ page language="java" pageEncoding="ISO-8859-1" contentType="text/html;charset=ISO-8859-1"%> <%@ taglib uri="/WEB-INF/c.tld" prefix="c" %> <%@ taglib uri="/WEB-INF/taglibs-datetime.tld" prefix="dt" %> <%@ page isELIgnored="false" %> <html> <head> <title>Liste</title> </head> <body> <h2>Liste</h2> <table border="1"> <tr> <th>Domaine</th> <th></th> </tr> <c:forEach var="domaine" items="${domaines}"> <tr> <td><c:out value="${domaine.aiddomaine}"/></td> </tr> </c:forEach> </table> </body> </html>
Ma classe DAO:
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 package code.web; import java.util.HashMap; import java.util.Map; import code.service.IService; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; //import org.springframework.web.bind.RequestUtils; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.Controller; public class Menu1 implements Controller { IService service; public IService getService(){ return service; } public void setService(IService service){ this.service=service; } public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception { String alogin="sniper"; Map model = new HashMap(); model.put("domaines", service.getDomaine(alogin)); return new ModelAndView("menu1", model); } }
Mon fichier XML d IBATIS:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 package code.dao; import java.util.Collection; import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport; public class DaoImplDomaine extends SqlMapClientDaoSupport implements IDao { public Collection getDomaine(String alogin){ return getSqlMapClientTemplate().queryForList("Appartient.getdomaine", new String(alogin) ); } }
Le prb c que qd j éxecute ma jsp il y a que ça qui est afficher
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 <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd"> <sqlMap> <!-- alias classe [Appartient] --> <typeAlias alias="Appartient.classe" type="code.tables.Appartient"/> <!-- mapping table [Appartient] - objet [Appartient] --> <resultMap id="Appartient.map" class="Appartient.classe"> <result property="alogin" column="a_login" /> <result property="aiddomaine" column="a_id_domaine" /> </resultMap> <!-- obtenir une personne en particulier --> <select id="Appartient.getdomaine" resultMap="Appartient.map" >select a_id_domaine FROM appartient WHERE a_login LIKE '%value%'</select> </sqlMap>et le résultat de la requette n est pas afficher est ce que qlq un vois le prb.
Code : Sélectionner tout - Visualiser dans une fenêtre à part <th>Domaine</th>
Merci
Partager