Bonjour,
J'ai un petit problème avec le modalPanel de richFaces.
Ma page est une dataTable avec un lien d'édition sur chaque row, qui ouvre un modalPanel avec un formulaire pour modifier l'objet de la ligne en question.
Tout marche à priori bien, mais les valeurs du formulaire d'édition (dans le modalPanel donc) ne sont pas envoyées au managedBean.
En debug sur la methode de validation du formulaire je me retrouve avec un objet qui est trait pour trait celui envoyé lors du clic sur le lien d'ouverture de la popup.
La page principale
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 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets"> <a4j:keepAlive beanName="clientAction" /> <ui:composition template="/pages/utils/template.xhtml"> <ui:define name="titre">Gestion des clients</ui:define> <ui:define name="contenu"> <h:form> <ui:include src="/pages/clients/formulaires/clientListe.xhtml" /> </h:form> </ui:define> </ui:composition> </html>
La page avec le dataTable (/pages/clients/formulaires/clientListe.xhtml)
La page du popUp d'édition (/pages/clients/popup/editionPopUp.xhtml)
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
86
87
88
89
90
91
92 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:fiji="http://exadel.com/fiji"> <h:form> <a4j:region> <rich:dataTable value="#{clientAction.listeClients}" var="client" rows="5" id="tableClients"> <rich:column sortBy="#{client.nom}" label="Nom"> <f:facet name="header">nom</f:facet> <h:outputText value="#{client.nom}" /> </rich:column> <rich:column label="Prenom"> <f:facet name="header">prenom</f:facet> <h:outputText value="#{client.prenom}" /> </rich:column> <rich:column label="Entreprise"> <f:facet name="header">entreprise</f:facet> <h:outputText value="#{client.entreprise}" converter="entrepriseConverter" /> </rich:column> <rich:column label="Telephone"> <f:facet name="header">telephone</f:facet> <h:outputText value="#{client.telephone}" /> </rich:column> <rich:column label="Mobile" visible="false"> <f:facet name="header">mobile</f:facet> <h:outputText value="#{client.mobile}" /> </rich:column> <rich:column label="Fax" visible="false"> <f:facet name="header">fax</f:facet> <h:outputText value="#{client.fax}" /> </rich:column> <rich:column label="Adresse" visible="false"> <f:facet name="header">adresse</f:facet> <h:outputText value="#{client.adresse}" /> </rich:column> <rich:column label="Code postal" visible="false"> <f:facet name="header">codePostal</f:facet> <h:outputText value="#{client.codePostal}" /> </rich:column> <rich:column label="Ville"> <f:facet name="header">ville</f:facet> <h:outputText value="#{client.ville}" /> </rich:column> <rich:column label="Pays"> <f:facet name="header">pays</f:facet> <h:outputText value="#{client.pays}" /> </rich:column> <rich:column label="Edition"> <f:facet name="header">actions</f:facet> <!-- Lien PopUp edition --> <a4j:commandLink ajaxSingle="true" id="editlink" oncomplete="#{rich:component('editPanel')}.show()"> <h:graphicImage value="/img/icons/pencil.ico" style="border:0" /> <f:setPropertyActionListener value="#{client}" target="#{clientAction.clientEdit}" /> <f:setPropertyActionListener value="#{row}" target="#{clientAction.currentRow}" /> </a4j:commandLink> <rich:toolTip for="editlink" value="Editer client" /> <!-- Lien PopUp delete --> <a4j:commandLink ajaxSingle="true" id="deletelink" oncomplete="#{rich:component('deletePanel')}.show()"> <h:graphicImage value="/img/icons/delete.ico" style="border:0" /> <f:setPropertyActionListener value="#{client}" target="#{clientAction.clientEdit}" /> <f:setPropertyActionListener value="#{row}" target="#{clientAction.currentRow}" /> </a4j:commandLink> <rich:toolTip for="deletelink" value="Supprimer client" /> </rich:column> </rich:dataTable> </a4j:region> </h:form> <!-- PopUp d'edition --> <ui:include src="/pages/clients/popup/editionPopUp.xhtml" /> <!-- PopUp suppression --> <ui:include src="/pages/clients/popup/suppressionPopUp.xhtml" /> </html>
J'ai beau fouiller, rien à faire , l'objet client utilisé ("clientEdit") reste désespérément vide de modifications ...
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:fiji="http://exadel.com/fiji"> <!--============================================================ ===================POPUP EDITION CLIENT========================= ================================================================--> <rich:modalPanel id="editPanel" autosized="true" width="550"> <f:facet name="header"> <h:outputText value="Edition client" /> </f:facet> <f:facet name="controls"> <h:panelGroup> <h:graphicImage value="/img/icons/close.gif" onclick="Richfaces.hideModalPanel('editPanel');" /> <rich:componentControl for="editPanel" attachTo="hidelink" operation="hide" event="onclick" /> </h:panelGroup> </f:facet> <h:form> <a4j:outputPanel ajaxRendered="true"> <rich:panel> <rich:panel header="civilite"> <table> <tr> <td><h:outputText value="Prenom :" /></td> <td><h:inputText value="#{clientAction.clientEdit.prenom}" immediate="true" /></td> <td><h:outputText value="Nom :" /></td> <td><h:inputText value="#{clientAction.clientEdit.nom}" /></td> </tr> <tr> <td><h:outputText value="Entreprise" /></td> <td colspan="3"><h:selectOneMenu value="#{clientAction.clientEdit.entreprise}" converter="entrepriseConverter"> <f:selectItems value="#{entrepriseAction.comboEntreprises}" /> </h:selectOneMenu></td> </tr> </table> </rich:panel> <br /> <rich:panel header="contact"> <table> <tr> <td><h:outputText value="telephone :" /></td> <td><h:inputText value="#{clientAction.clientEdit.telephone}" /></td> <td><h:outputText value="mobile :" /></td> <td><h:inputText value="#{clientAction.clientEdit.mobile}" /></td> </tr> <tr> <td><h:outputText value="fax :" /></td> <td><h:inputText value="#{clientAction.clientEdit.fax}" /></td> </tr> <tr> <td><h:outputText value="mail :" /></td> <td colspan="3"><h:inputText value="#{clientAction.clientEdit.mail}" size="50" /></td> </tr> </table> </rich:panel> <br /> <rich:panel header="Localisation"> <table> <tr> <td><h:outputText value="adresse :" /></td> <td><h:inputText value="#{clientAction.clientEdit.adresse}" size="50" /></td> </tr> <tr> <td><h:outputText value="codePostal :" /></td> <td><h:inputText value="#{clientAction.clientEdit.codePostal}" /></td> </tr> <tr> <td><h:outputText value="ville :" /></td> <td><h:inputText value="#{clientAction.clientEdit.ville}" /></td> </tr> <tr> <td><h:outputText value="pays :" /></td> <td><h:inputText value="#{clientAction.clientEdit.pays}" id="clientPays" /></td> </tr> </table> </rich:panel> <br /> <a4j:commandButton value="Valider" ajaxSingle="true" action="#{clientAction.editerClient}" oncomplete="if (#{facesContext.maximumSeverity==null}) #{rich:component('editPanel')}.hide();" reRender="tableClients" style="position:relative;left:40%;" /> </rich:panel> <rich:suggestionbox width="200" height="150" selfRendered="true" suggestionAction="#{referentielAction.autocompletePays}" for="clientPays" var="result" fetchValue="#{result.nomFr}"> <h:column> <h:outputText value="#{result.code}" /> </h:column> <h:column> <h:outputText value="#{result.nomFr}" style="font-style:italic" /> </h:column> </rich:suggestionbox> </a4j:outputPanel> </h:form> </rich:modalPanel> </html>
Partager