salut,
j'ai passé des journées à comprendre un phénomeme que je n'ai pas réussi à le saisir:
j'ai une datatable qu contient des données stockés dans une liste codée à la main.
sur cette DT il ya un commandButton qui permet de supprimer la ligne courante
quand je clique su le bouton rien ne se passe
pourtant le code me semble correct
voici le contenu de ma page jsp:
voici mon bean managé profilBean
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
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
77
78
79
80
81
82
83
84
85 <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%> <%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%> <%@ taglib prefix="rich" uri="http://richfaces.org/rich"%> <%@ taglib prefix="a4j" uri="http://richfaces.org/a4j"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <link href="/CSS/chatsmsweb.css" rel="stylesheet" type="text/css" /> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>titre de la page</title> </head> <body> <f:view> <h:form> <rich:panel styleClass="outputText" style="border:1; border-color:red;margin-left:200px;bottom:200px; width : 599px;"> <f:facet name="header"> <h:outputText value="Liste des membres du chat" /> </f:facet> <rich:dataTable id="tableprofils" value="#{profilBean.profils}" var="profil" rowKeyVar="row"> <h:column> <f:facet name="header"> <h:outputText value="Pseudo" /> </f:facet> <h:outputText id="pseudo" value="#{profil.pseudo}" /> </h:column> <h:column> <f:facet name="header"> <h:outputText value="Téléphone" /> </f:facet> <h:outputText id="numtel" value="#{profil.numTel}" /> </h:column> <h:column> <f:facet name="header"> <h:outputText value="sexe" /> </f:facet> <h:outputText id="sexe" value="#{profil.sexe}" /> </h:column> <h:column> <f:facet name="header"> <h:outputText value="centre d'interet" /> </f:facet> <h:outputText id="hobby" value="#{profil.hobby}" /> </h:column> <h:column> <f:facet name="header"> <h:outputText value="salon" /> </f:facet> <h:outputText id="salon" value="#{profil.salon}" /> </h:column> <h:column> <f:facet name="header"> <h:outputText value="date d'inscription" /> </f:facet> <h:outputText id="insdate" value="#{profil.insDate}" /> </h:column> <h:column> <f:facet name="header"> <h:outputText value="action" /> </f:facet> <a4j:commandButton value="Supprimer" action="#{profilBean.delete}" reRender="tableprofils"> <f:setPropertyActionListener target="#{profilBean.rowIndex}" value="#{row}"/> </a4j:commandButton> </h:column> </rich:dataTable> </rich:panel> </h:form> </f:view> </body> </html
je me suis cassé trop la tete
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
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 package beans; import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; import model.Profil; public class ProfilBean { int rowIndex; public int getRowIndex() { return rowIndex; } public void setRowIndex(int rowIndex) { this.rowIndex = rowIndex; } private List<Profil> profils; public List<Profil> getProfils() { return profils; } public void delete() { profils.remove(rowIndex); } @PostConstruct public void init() { try { profils = new ArrayList<Profil>(); profils.add(new Profil("22505050", "male", "25", "sport", "jeunesse", "toto", "22-08-2009 08:20:50")); profils.add(new Profil("22404040", "femelle", "19", "musique", "jeunesse", "titi", "09-10-2009 15:43:15")); profils.add(new Profil("22303030", "male", "35", "foot", "sport", "midou", "15-09-2009 23:26:32")); profils.add(new Profil("22202020", "femelle", "22", "lecture", "cuisine", "sallouha", "27-10-2009 19:22:25")); profils.add(new Profil("22212221", "femelle", "22", "musique", "cuisine", "ammoura", "07-10-2009 19:12:25")); profils.add(new Profil("22232223", "male", "28", "foot", "beauté", "hannouna", "28-08-2009 14:25:28")); profils.add(new Profil("22242224", "male", "25", "voley", "jeunesse", "riri", "07-10-2009 19:12:25")); profils.add(new Profil("22162020", "femelle", "31", "voyage", "beauté", "daddou", "07-10-2009 19:12:25")); } catch (Exception e) { e.printStackTrace(); } } public void setProfils(List<Profil> profils) { this.profils = profils; } }et je commence à deseperer
j'ai tout essayé mais rien ne marche
Partager