Bonjour tout le monde,
J'ai une application JEE que j'ai créé avec struts, le problème que j'ai se situe au niveau de l'affichage d'une liste de données que je récupère à partir de ma BD Mysql.
Tout au départ ie à la connexion dans l'application, l'affichage des données est bon, mais il suffit que j'ajoute des données à partir de mon application, j'ai plus la bonne mise à jour de l'affichage.
Au fait , il m'affiche pas les données de la base et en plus dans l'affichage il y'a une dupplication de l'élément nouvellement ajouté.
Je vous poste mon code :
page jsp :
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
| <%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<%@ page language="java" contentType="text/html" import="DAO.*, java.util.*,java.text.*, Entities.*"%>
<%
AcpJpaController acpJpa = new AcpJpaController();
List<Acp> acp =acpJpa.findAcpNonValidees();
//session.setAttribute("acpList", acpRecu);
if(acp.size()==0) out.println("<p style='color: red'><b>Il n'existe aucune AC/P à valider</b></p>");
else {
%>
<fieldset style="background-color:buttonface; width: 900px;">
<legend style="color:#5A5A5A; background-color:white">[ Les AC/P reçes non validées ]</legend>
<table border="0px" cellpadding="4px" >
<tr bgcolor="#5A5A5A" style="color:white">
<td>N°ACP</td> <td>Type</td> <td>Date création</td> <td>Emetteur</td> <td>Concerné</td>
<td>Qualification</td> <td>Opérations</td>
</tr>
<%
int j,m,a;
for(int i=0; i<acp.size(); i++)
{
j= acp.get(i).getDateCreation().getDate();
m = acp.get(i).getDateCreation().getMonth()+1;
a = acp.get(i).getDateCreation().getYear()+1900;
%>
<tr bgcolor="#D8D8D8">
<!--<tr style="background-image:url(images/menu.png);">-->
<td><%=acp.get(i).getNumeroAcp()%></td>
<td><%=acp.get(i).getTypeAcp()%></td>
<!-- <td align="center"><input type="checkbox" id="valider" disabled="false" onLoad="valider();"/></td> -->
<td align="center"><%=j+"-"+m+"-"+a%></td>
<td align="center"><%=acp.get(i).getEmetteurAcpIdService().getIdService()%></td>
<td align="center"><%=acp.get(i).getRecepteurAcpIdService().getIdService()%></td>
<td align="center"><%=acp.get(i).getQualification()%></td>
<td align="center">
<img src="images/img_view.png" alt="Afficher" name="view" />
<img src="images/img_delete.png" alt="Supprimer" name="delete" />
<img src="images/img_exporter.png" alt="Solution" name="solution" />
</td>
</tr>
<% }
%>
</table>
</fieldset>
<%
}
for(int i=0; i<acp.size(); i++)
{
acp.remove(i);
}
%>
<center>
<div class="footer">Copyright © 2010 ONDA</div>
</center>
</body>
</html> |
dans mon DAO package:
[CODE]
// Pour récupérer la liste de l'affichage
1 2 3 4 5 6 7 8 9 10 11
|
public List<Acp> findAcpNonValidees() {
EntityManager em = getEntityManager();
try {
String req = "select a from Acp a where a.validerAcp = 0 ORDER BY a.dateCreation DESC;";
Query query = em.createQuery(req);
return (List<Acp>) query.getResultList();
} finally {
em.close();
}
} |
J'ajoute que j'appelle via un <html:link > par :
<li class="sousmenu"><html:link page="/AcpRecu.do" >Le lien</html:link></li>
Partager