oui si tu tu utilise log4j..
Sinon tu peux utiliser un System.out.println..
oui si tu tu utilise log4j..
Sinon tu peux utiliser un System.out.println..
Articles: Richfaces - JBosstools pour JSF.
Bonjour j'espère que vous êtes en bonne santé
je suis débutant pour les logging jsf, je ne sais pas où trouver le fichier log où s'affiche les "after phase" et "before phase" alors j'ai ajouter un Sytem.out.println pour l'afficher au console comme ceci
j'ai tester avec un exemple d'appel au méthode init() de bean qui va m'afficher la page jsf pour le formulaire de saisi d'un nouveau intervenant c'est juste un exemple et pour le problème de reappel automatique au méthode existe partout méthode init(), create(), validate(), pour n'importe qu'elle méthode ces méthodes sont appeler depuis jsf suite au clique sur une bouton "nouveau" pour appeler init() ou "enregistrer" pour appeler "create" et ainsi de suite
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 public void afterPhase(javax.faces.event.PhaseEvent e) { log.debug("afterPhase " + e.getPhaseId()); System.out.println("afterPhase " + e.getPhaseId()); }
je reviens prenant l'exemple de "init()" pour l'affichage des logger sur le console j'ai ceci
Merci d'avance pour toute essaie d'aide
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 // ***************************************** Mon PB c'est que l'appel se fait 2 fois automatiquement // affichage avant 1èr appel au init() beforePhase RESTORE_VIEW 1 beforePhase RESTORE_VIEW 1 afterPhase RESTORE_VIEW 1 beforePhase APPLY_REQUEST_VALUES 2 afterPhase RESTORE_VIEW 1 beforePhase APPLY_REQUEST_VALUES 2 afterPhase APPLY_REQUEST_VALUES 2 beforePhase PROCESS_VALIDATIONS 3 afterPhase APPLY_REQUEST_VALUES 2 beforePhase PROCESS_VALIDATIONS 3 afterPhase PROCESS_VALIDATIONS 3 afterPhase PROCESS_VALIDATIONS 3 beforePhase UPDATE_MODEL_VALUES 4 afterPhase UPDATE_MODEL_VALUES 4 beforePhase INVOKE_APPLICATION 5 // 1èr appel init() ***************************************** // affichage aprés 1èr appel init() et avant 2ème appel au init() beforePhase UPDATE_MODEL_VALUES 4 afterPhase INVOKE_APPLICATION 5 beforePhase RENDER_RESPONSE 6 afterPhase UPDATE_MODEL_VALUES 4 afterPhase RENDER_RESPONSE 6 beforePhase INVOKE_APPLICATION 5 // 2ème appel au init() ********************************************* // affichage aprés 2ème appel au init() afterPhase INVOKE_APPLICATION 5 beforePhase RENDER_RESPONSE 6 afterPhase RENDER_RESPONSE 6![]()
tu peux montrer le code de ta page JSF.
Articles: Richfaces - JBosstools pour JSF.
page nouveau intervenant
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138 <ui:composition template="/faces/templates/neweditTemplate.xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jstl/core"> <ui:define name="object"> <h:commandLink id="hlinkCreateOpen" action="#{lubrIntervenant_newedit.create}"> <f:param name="createaction" value="open" /> <f:param name="operation" value="nouveau" /> </h:commandLink> <h:commandLink id="hlinkCreateClose" action="#{lubrIntervenant_newedit.create}"> <f:param name="createaction" value="close" /> </h:commandLink> <b> <h:outputLabel styleClass="outputLabel" style="COLOR: #000080; font-size:11pt" value="#{i18n.intervenant_tab_context}"></h:outputLabel> </b> <rich:tabPanel switchType="client" style="paddin : 0px 0px 0px 0px"> <rich:tab label="#{i18n.intervenant_tab_label_infogen}"> <rich:panel> <h:panelGrid columns="3"> <h:outputLabel styleClass="outputLabel" value="#{i18n.intervenant_tab_nomprenom}"></h:outputLabel> <h:outputLabel styleClass="outputLabel" value=":"></h:outputLabel> <h:panelGrid columns="2"> <h:inputText id="txtnompren" value="#{lubrIntervenant_newedit.lubrIntervenant.nompren}" required="true" requiredMessage="*" style="width:400px" /> <rich:message id="msgtxtnompren" for="txtnompren" style="color:red;font-size:13px" /> </h:panelGrid> <h:outputLabel styleClass="outputLabel" value="#{i18n.intervenant_tab_couthoraire}"></h:outputLabel> <h:outputLabel styleClass="outputLabel" value=":"></h:outputLabel> <h:inputText value="#{lubrIntervenant_newedit.lubrIntervenant.couthora}" style="width:200px" /> </h:panelGrid> </rich:panel> <rich:panel style="border : 0"> <h:outputLabel styleClass="outputLabel" value="#{i18n.intervenant_tab_label_coordonnee}"></h:outputLabel> </rich:panel> <rich:panel> <h:panelGrid columns="3"> <h:outputLabel styleClass="outputLabel" value="#{i18n.intervenant_tab_adresse}"></h:outputLabel> <h:outputLabel styleClass="outputLabel" value=":"></h:outputLabel> <h:panelGrid columns="2"> <h:inputText id="txtadre" required="true" requiredMessage="*" value="#{lubrIntervenant_newedit.lubrIntervenant.adre}" style="width:400px" /> <rich:message id="msgtxtadre" for="txtadre" style="color:red;font-size:13px" /> </h:panelGrid> <h:outputLabel styleClass="outputLabel" value="#{i18n.intervenant_tab_cptadresse}"></h:outputLabel> <h:outputLabel styleClass="outputLabel" value=":"></h:outputLabel> <h:inputText value="#{lubrIntervenant_newedit.lubrIntervenant.compadre}" style="width:400px" /> <h:outputLabel styleClass="outputLabel" value="#{i18n.intervenant_tab_ville}"></h:outputLabel> <h:outputLabel styleClass="outputLabel" value=":"></h:outputLabel> <h:panelGrid columns="2"> <h:inputText id="txtvill" required="true" requiredMessage="*" value="#{lubrIntervenant_newedit.lubrIntervenant.vill}" style="width:400px" /> <rich:message id="msgtxtvill" for="txtvill" style="color:red;font-size:13px" /> </h:panelGrid> <h:outputLabel styleClass="outputLabel" value="#{i18n.intervenant_tab_cdpostal}"></h:outputLabel> <h:outputLabel styleClass="outputLabel" value=":"></h:outputLabel> <a4j:outputPanel columns="2" ajaxRendered="true"> <h:inputText id="txtcodepost" required="true" requiredMessage="*" converterMessage="Il faut saisir une valeur numerique" value="#{lubrIntervenant_newedit.lubrIntervenant.codepost}" style="width:300px"> <f:convertNumber floatOnly="true" /> <a4j:support event="onblur" /> </h:inputText> <rich:message id="msgtxtcodepost" for="txtcodepost" style="color:red;font-size:13px" /> </a4j:outputPanel> <h:outputLabel styleClass="outputLabel" value="#{i18n.intervenant_tab_tel}"></h:outputLabel> <h:outputLabel styleClass="outputLabel" value=":"></h:outputLabel> <h:inputText value="#{lubrIntervenant_newedit.lubrIntervenant.tele}" style="width:300px" /> <h:outputLabel styleClass="outputLabel" value="#{i18n.intervenant_tab_fax}"></h:outputLabel> <h:outputLabel styleClass="outputLabel" value=":"></h:outputLabel> <h:inputText value="#{lubrIntervenant_newedit.lubrIntervenant.fax}" style="width:300px" /> <h:outputLabel styleClass="outputLabel" value="#{i18n.intervenant_tab_adrelect}"></h:outputLabel> <h:outputLabel styleClass="outputLabel" value=":"></h:outputLabel> <h:panelGrid columns="2"> <h:inputText id="txtadreelec" validator="#{lubrIntervenant_newedit.validate}" value="#{lubrIntervenant_newedit.lubrIntervenant.adreelec}" style="width:300px" /> <h:message id="msgtxtadreelec" for="txtadreelec" style="color:red;font-size:13px" /> </h:panelGrid> </h:panelGrid> </rich:panel> </rich:tab> </rich:tabPanel> </ui:define> </ui:composition>
et la page qui appel nouveau intervenant
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142 <ui:composition template="/faces/templates/listeTemplate.xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:opt="http://primefaces.prime.com.tr/optimus"> <ui:define name="filter"> <h:commandLink id="hlinkCreate" action="#{lubrIntervenant_newedit.init}" > <f:param name="operation" value="nouveau" /> </h:commandLink> <a4j:htmlCommandLink id="hlinkExport"> <p:dataExporter type="xls" target="dataTable" fileName="listeIntervenant" excludeColumns="10"/> </a4j:htmlCommandLink> <a4j:htmlCommandLink id="hlinkExportPDF"> <p:dataExporter type="pdf" target="dataTable" fileName="listeIntervenant" excludeColumns="10" /> </a4j:htmlCommandLink> <a4j:htmlCommandLink id="hlinkExportCSV"> <p:dataExporter type="csv" target="dataTable" fileName="listeIntervenant" excludeColumns="10" /> </a4j:htmlCommandLink> <h:panelGrid columns="3" id="gridFilter"> <h:outputLabel styleClass="outputLabel" value="#{i18n.lubrIntervenant_filter_nompren}"></h:outputLabel> <h:outputLabel styleClass="outputLabel" value=":"></h:outputLabel> <h:inputText value="#{lubrIntervenantBean.nompren}" style="width : 300px"/> </h:panelGrid> <h:commandButton value="#{i18n.common_btn_rechercher}" action="#{lubrIntervenantBean.findItems}" /> <a4j:commandButton value="Effacer" action="#{lubrIntervenantBean.effacer}" reRender="gridFilter" /> </ui:define> <ui:define name="resultat"> <rich:dataTable style="width : 98% ; align : center" binding="#{lubrIntervenantBean.dataTable}" id="dataTable"> <f:facet name="header"> <h:outputLabel styleClass="outputLabel" value="#{i18n.lubrIntervenant_resultat}"></h:outputLabel> </f:facet> <rich:column id="colcodeinte" sortBy="#{item.codeinte}"> <f:facet name="header"> <h:outputLabel styleClass="outputLabel" value="#{i18n.lubrIntervenant_codeinte}"></h:outputLabel> </f:facet> <h:outputText value="#{item.codeinte}" /> </rich:column> <rich:column id="colnompren" sortBy="#{item.nompren}"> <f:facet name="header"> <h:outputLabel styleClass="outputLabel" value="#{i18n.lubrIntervenant_nompren}"></h:outputLabel> </f:facet> <h:outputText value="#{item.nompren}" /> </rich:column> <rich:column id="coladre" sortBy="#{item.adre}"> <f:facet name="header"> <h:outputLabel styleClass="outputLabel" value="#{i18n.lubrIntervenant_adre}"></h:outputLabel> </f:facet> <h:outputText value="#{item.adre}" /> </rich:column> <rich:column id="colcompadre" sortBy="#{item.compadre}"> <f:facet name="header"> <h:outputLabel styleClass="outputLabel" value="#{i18n.lubrIntervenant_compadre}"></h:outputLabel> </f:facet> <h:outputText value="#{item.compadre}" /> </rich:column> <rich:column id="colcodepost" sortBy="#{item.codepost}"> <f:facet name="header"> <h:outputLabel styleClass="outputLabel" value="#{i18n.lubrIntervenant_codepost}"></h:outputLabel> </f:facet> <h:outputText value="#{item.codepost}" /> </rich:column> <rich:column id="colvill" sortBy="#{item.vill}"> <f:facet name="header"> <h:outputLabel styleClass="outputLabel" value="#{i18n.lubrIntervenant_vill}"></h:outputLabel> </f:facet> <h:outputText value="#{item.vill}" /> </rich:column> <rich:column id="coltele" sortBy="#{item.tele}"> <f:facet name="header"> <h:outputLabel styleClass="outputLabel" value="#{i18n.lubrIntervenant_tele}"></h:outputLabel> </f:facet> <h:outputText value="#{item.tele}" /> </rich:column> <rich:column id="colfax" sortBy="#{item.fax}"> <f:facet name="header"> <h:outputLabel styleClass="outputLabel" value="#{i18n.lubrIntervenant_fax}"></h:outputLabel> </f:facet> <h:outputText value="#{item.fax}" /> </rich:column> <rich:column id="colcouthora" sortBy="#{item.couthora}"> <f:facet name="header"> <h:outputLabel styleClass="outputLabel" value="#{i18n.lubrIntervenant_couthora}"></h:outputLabel> </f:facet> <h:outputText value="#{item.couthora}" /> </rich:column> <rich:column id="coladreelec" sortBy="#{item.adreelec}"> <f:facet name="header"> <h:outputLabel styleClass="outputLabel" value="#{i18n.lubrIntervenant_adreelec}"></h:outputLabel> </f:facet> <h:outputText value="#{item.adreelec}" /> </rich:column> <rich:column id="action"> <f:facet name="header"> <h:outputLabel styleClass="outputLabel" value="Actions"></h:outputLabel> </f:facet> <rich:dropDownMenu value="Action"> <rich:menuItem value="Consulter" icon="#{a4jSkin.nameSkin}/img/Affichage.gif" action="#{lubrIntervenant_newedit.init}"> <f:param name="codeinte" value="#{item.codeinte}"/> <f:param name="operation" value="consulter"/> </rich:menuItem> <rich:menuItem value="Modifier" icon="#{a4jSkin.nameSkin}/img/edititem.gif" action="#{lubrIntervenant_newedit.init}" > <f:param name="codeinte" value="#{item.codeinte}"/> <f:param name="operation" value="modifier"/> </rich:menuItem> <rich:menuItem value="Supprimer" disabled="true" icon="#{a4jSkin.nameSkin}/img/Delete_rouge.gif" action="#{lubrIntervenant_newedit.delete}"> <f:param name="codeinte" value="#{item.codeinte}"/> <f:param name="operation" value="delete"/> </rich:menuItem> </rich:dropDownMenu> </rich:column> <f:facet name="footer"> <rich:datascroller binding="#{structureBean.dataScroller}" /> </f:facet> </rich:dataTable> </ui:define> </ui:composition>
la page nouveau intervenant est appeler par ce bout code
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 <h:commandLink id="hlinkCreate" action="#{lubrIntervenant_newedit.init}" > <f:param name="operation" value="nouveau" /> </h:commandLink>
l'affichage de logger citer précedament c'est pour init() Structure je vais vous donner l'affichage pour l'appel au méthode init() intervenant
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 // ***************************************** Mon PB c'est que l'appel se fait 2 fois automatiquement // affichage avant 1èr appel au init() beforePhase RESTORE_VIEW 1 beforePhase RESTORE_VIEW 1 afterPhase RESTORE_VIEW 1 beforePhase APPLY_REQUEST_VALUES 2 afterPhase APPLY_REQUEST_VALUES 2 afterPhase RESTORE_VIEW 1 beforePhase APPLY_REQUEST_VALUES 2 afterPhase APPLY_REQUEST_VALUES 2 beforePhase PROCESS_VALIDATIONS 3 afterPhase PROCESS_VALIDATIONS 3 beforePhase PROCESS_VALIDATIONS 3 beforePhase UPDATE_MODEL_VALUES 4 afterPhase PROCESS_VALIDATIONS 3 afterPhase UPDATE_MODEL_VALUES 4 beforePhase INVOKE_APPLICATION 5 beforePhase UPDATE_MODEL_VALUES 4 // 1èr appel init() ***************************************** // affichage aprés 1èr appel init() et avant 2ème appel au init() afterPhase UPDATE_MODEL_VALUES 4 afterPhase INVOKE_APPLICATION 5 beforePhase RENDER_RESPONSE 6 beforePhase INVOKE_APPLICATION 5 afterPhase RENDER_RESPONSE 6 // 2ème appel au init() ********************************************* // affichage aprés 2ème appel au init() afterPhase INVOKE_APPLICATION 5 beforePhase RENDER_RESPONSE 6 afterPhase RENDER_RESPONSE 6
j'ai remarqué que suite au clique sur le bouton "nouveau" la méthode "init()" de Bean "nouveau interevant" sera appeler deux fois et maitenant si je suis dans la page nouveau et je fait actualiser la même méthode init s'éxecute une seule fois
Merci d'avance pour vos aides![]()
j'ai remplacé le DataSourceDynamique AbstractRoutingDataSource
par le
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 org.springframework.jdbc.datasource.DriverManagerDataSource utiliser dans ApplicationContextDataSource.xml
car j'ai cru que le problème vient de que je travail d'un dynamique datasource mais le problème reste le même
Code : Sélectionner tout - Visualiser dans une fenêtre à part BasicDataSource de org.apache![]()
voila le logger suite à l'actualisation de page
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 // *********** le logger suite actualisation de page //************ init() est appelé une seule fois // affichage avant appel au init() beforePhase RESTORE_VIEW 1 afterPhase RESTORE_VIEW 1 beforePhase APPLY_REQUEST_VALUES 2 afterPhase APPLY_REQUEST_VALUES 2 beforePhase PROCESS_VALIDATIONS 3 afterPhase PROCESS_VALIDATIONS 3 beforePhase UPDATE_MODEL_VALUES 4 afterPhase UPDATE_MODEL_VALUES 4 beforePhase INVOKE_APPLICATION 5 // appel init() ***************************************** // affichage aprés appel au init() afterPhase INVOKE_APPLICATION 5 beforePhase RENDER_RESPONSE 6 afterPhase RENDER_RESPONSE 6
enfin j'ai localiser d'oû vient l'erreur mais je ne sais pas comment la résoudre
pour mieux comprendre prenant le cas que je vais passer de la page "Liste des intervenants" à la page "nouveau intervenant"
NB: la page "Liste intervenant" est réaliser en integrant une template que j'ai réalisé "ListeTemplate.xhtml" dont le code que nous intéresse c'est le menu ou on trouve bouton nouveau intervenant
et maintenant pour utilisé cette template pour la création de fichier Liste intervenant.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 <ui:composition xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" ... // je vais présenter le code que nous intéresse <a4j:loadScript src="/js/menu.js" /> <a4j:loadStyle src="/style/StyleSheet.css"></a4j:loadStyle> <h:form id="formFilter" style="margin:0px 0px 0px 0px;padding:0px 0px 0px 0px;"> <ui:include src="/faces/common/menu.xhtml" style="margin:0px 0px 0px 0px;padding:0px 0px 0px 0px;" /> <rich:toolBar id="menu" width="100%"> <rich:menuItem submitMode="ajax" value="Nouveau" icon="/img/16x16/newitem.gif" onclick="evalLink('formFilter:hlinkCreate')"> // ici j'ai utilisé onclick une fonction javascript pour chercher l'élément // selectionner dont le code est le suivant function evalLink(id) { if(document.getElementById(id) == null) { id = 'formFilter' + id.substring(id.indexOf(':')); } if(document.getElementById(id).dispatchEvent) { var target = document.getElementById(id); oEvent = document.createEvent("MouseEvents"); oEvent.initMouseEvent("click",true,true,window,1,1,1,1,1,false,false,false,false,0,target); target.dispatchEvent(oEvent); } else document.getElementById(id).click(); } </rich:menuItem>
c'est pour ça que j'ai deux appels successive pour la même méthodes mais maintenant je sais pas comment la corriger. parce que je veux rester utiliser template.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9 <ui:composition template="/faces/templates/listeTemplate.xhtml" xmlns:f="http://java.sun.com/jsf/core" .... <ui:define name="filter"> <h:commandLink id="hlinkCreate" action="#{structure_browse.init}"> <f:param name="operation" value="nouveau" /> </h:commandLink> // ici on a implémenté le formFilter de Template et utiliser le hlinkCreate
si quelqu'un à une idée je suis preneur
Rq :
ce problème de reappel c'est seulement sous IE mais sous FireFox il marche sans problème
enfin j'ai résolu mon problème est résolu
au lieu d'utiliser
j'ai utilisé
Code : Sélectionner tout - Visualiser dans une fenêtre à part h:commandLink
car l'évenement de clique sur
Code : Sélectionner tout - Visualiser dans une fenêtre à part a4j:htmlCommandLinkest intercepter par le code javascript getElementByID.click alors le code dans le Bean s'éxecute 2 fois mais quand je l'ai chagé avec
Code : Sélectionner tout - Visualiser dans une fenêtre à part h:commandLinkil marche bien, mais je ne sais pas pourquoi et c'est quoi la différence. le plus important ce qu'il marche maintenant
Code : Sélectionner tout - Visualiser dans une fenêtre à part a4j:htmlCommandLink
j'ai un autre problème pour ce qu'il peut m'aider j'utilise le dataSourcec'est un datasource dynamique pour que je puisse redirigé l'utilisateur vers son propre base de données au moment de connexion seon login et mot de passe (Application mode SAAS) mais mon problème ce que lorsque la base est choisi et l'utilisateur commence à utilisé l'Application il se peut qu'elle change la base de données vers une autre et suite à autre clique elle revient c'est un grand problème Merci pour tout personne essaye de m'aider
Code : Sélectionner tout - Visualiser dans une fenêtre à part AbstractRoutingDataSource
http://blog.springsource.com/2007/01...ource-routing/ c'est un lien pour ce qu'il veut connaitre Datasource Dynamique
Partager