IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JSF Java Discussion :

Un <p:commandButton fonctionne, l'autre non


Sujet :

JSF Java

  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    92
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 92
    Par défaut Un <p:commandButton fonctionne, l'autre non
    Bonsoir, je me suis mis à primefaces 3 concernant le jeu de composants qui m'a l'air bien fourni et bien écrit.

    J'ai commencé à bricoler un truc pour tester tout ça, mais comme dit dans le titre, j'ai un premier <p:commandButton qui fonctionne, et qui me permet d'initialiser mes objets dans ma base, un autre est destiné à enregistrer les gruopes de l'utilisateur sélectionné, le code ne réalise pas la sauvegarde mais j'affiche un retour dans le log pour débuger, mais la méthode n'est jamais atteinte... et je tourne en rond
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    public void groupListSaveBtnAction() {
            log.trace("groupListSaveBtnAtion ...");
            JsfUtil.addInfoMessage("INFO", "Group list saved");
            //force reload user's groups in database
            log.trace("force load user's group in database (groupes = null)");
            groupes = null;
        }
    Le code est simple, j'affiche la liste des utilisateurs, j'en sélectionne un, update auto qui affiche un <p:picklist avec les groupes de l'utilisateur. On modifie les groupes et on clique sur Save, qui est le 2eme ^<p:commandButton, il est bien dans un formulaire, il me semble bien écrit mais dans le log que j'ai détaillé, l'action n'est jamais déclenchée.
    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
          <h:form id="userListForm">
                <p:panel id="userListPanel" style="width:640px">
                    <p:dataTable value="#{utilisateurBean.userList}" var="user" style="width:340px" 
                                 selection="#{utilisateurBean.selectedUser}" selectionMode="single"
                                 rowEditListener="#{utilisateurBean.indexRowEditListener}" 
                                 onRowEditUpdate="growl"
                                 rowSelectListener="#{utilisateurBean.indexRowSelectListener}"
                                 onRowSelectUpdate="userGroupForm growl"
                                 rowUnselectListener="#{utilisateurBean.indexRowUnselectListener}"
                                 onRowUnselectUpdate="userGroupForm growl">
     
                        <f:facet name="header">
                            In-Cell Editing
                        </f:facet>
     
                        <p:column headerText="Login" style="width:80px">
                            <h:outputText value="#{user.login}"/>
                        </p:column>
     
                        <p:column headerText="Password" style="width:80px">
                            <p:cellEditor>
                                <f:facet name="output">
                                    <h:outputText value="#{user.password}"/>
                                </f:facet>
                                <f:facet name="input">
                                    <p:inputText value="#{user.password}" style="width:100%"/>
                                </f:facet>
                            </p:cellEditor>
                        </p:column>
     
                        <p:column headerText="Roles" style="width:80px">
                            <ui:repeat value="#{user.groupes}" var="groupe">
                                <h:outputText value="#{groupe.groupName}" />
                                <br />
                            </ui:repeat>
                        </p:column>
     
     
                        <p:column headerText="Options" style="width:20px">
                            <p:rowEditor />
                        </p:column>
     
                        <f:facet name="footer">
                            footer
                        </f:facet>
     
                    </p:dataTable>
                </p:panel>
            </h:form>
            <br />
            <h:form id="userGroupForm" >
                <p:panel id="userGroupListPanel" style="width:640px" rendered="#{utilisateurBean.selectedUser!=null}">
                    <p:pickList id="userGroupPickList" value="#{utilisateurBean.groupes}" 
                                var="groupe" 
                                itemLabel="#{groupe.groupNameString}" 
                                itemValue="#{groupe.groupNameString}" 
     
                                >
                        <f:facet name="sourceCaption">Others roles</f:facet>
                        <f:facet name="targetCaption">User's roles</f:facet>
                    </p:pickList>
                    <p:commandButton value="Save" update="userGroupForm:userGroupListPanel growl" action="#{utilisateurBean.groupListSaveBtnAction}" />
     
     
     
                </p:panel>
            </h:form>
    Voici un bout du log qui décrit ce qui se passe, quand je clique sur Save il déclenche 4 fois getSelectedUser et une dizaine de fois getUser, mais pas mon action groupListSaveBtnAction.
    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
    INFO: 22:06:48.899 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:06:48.950 TRACE [http-thread-pool-8080(5)] fr.espheria.bean.UtilisateurBean         - getSelectedUser !
    INFO: 22:06:48.950 TRACE [http-thread-pool-8080(5)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:06:48.950 DEBUG [http-thread-pool-8080(5)] fr.espheria.ejb.UtilisateurManager       - findEntities : fr.espheria.domain.Utilisateur ...
    INFO: 22:06:48.960 DEBUG [http-thread-pool-8080(5)] fr.espheria.ejb.UtilisateurManager       - findEntities : fr.espheria.domain.Utilisateur SUCCESSFUL
    INFO: 22:06:48.960 TRACE [http-thread-pool-8080(5)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:06:48.993 TRACE [http-thread-pool-8080(5)] fr.espheria.bean.UtilisateurBean         - getSelectedUser !
    INFO: 22:06:48.993 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:06:48.993 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:06:49.003 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:06:49.003 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:06:49.014 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:06:49.016 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:06:49.016 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:06:49.016 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:06:49.027 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:06:49.028 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:06:49.028 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:06:49.039 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:07:03.032 DEBUG [http-thread-pool-8080(4)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:07:03.042 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.042 DEBUG [http-thread-pool-8080(4)] fr.espheria.ejb.UtilisateurManager       - findEntities : fr.espheria.domain.Utilisateur ...
    INFO: 22:07:03.052 DEBUG [http-thread-pool-8080(4)] fr.espheria.ejb.UtilisateurManager       - findEntities : fr.espheria.domain.Utilisateur SUCCESSFUL
    INFO: 22:07:03.052 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.063 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.064 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.064 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.075 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.076 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.096 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.096 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.107 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.108 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.108 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.119 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.121 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.121 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.131 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.131 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.143 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.143 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.153 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.153 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.164 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.165 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.165 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.177 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.177 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.177 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.188 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.190 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.190 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.190 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.201 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.202 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - setSelectedUser ...
    INFO: 22:07:03.202 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - setSelectedUser DONE
    INFO: 22:07:03.213 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.215 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.215 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList ...
    INFO: 22:07:03.225 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getUserList DONE
    INFO: 22:07:03.225 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - indexRowSelectListener ...
    INFO: 22:07:03.236 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - loadGroupOfSelectedUser ...
    INFO: 22:07:03.237 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - selectedUser != null
    INFO: 22:07:03.237 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getOtherGroups ...
    INFO: 22:07:03.248 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getOtherGroups DONE
    INFO: 22:07:03.249 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - loadGroupOfSelectedUser DONE
    INFO: 22:07:03.249 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - indexRowSelectListener DONE
    INFO: 22:07:03.262 DEBUG [http-thread-pool-8080(4)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:07:03.272 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getSelectedUser !
    INFO: 22:07:03.272 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getSelectedUser !
    INFO: 22:07:03.272 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getSelectedUser !
    INFO: 22:07:03.283 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getSelectedUser !
    INFO: 22:07:03.284 TRACE [http-thread-pool-8080(4)] fr.espheria.bean.UtilisateurBean         - getGroups !
    INFO: 22:07:06.708 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:07:06.708 TRACE [http-thread-pool-8080(5)] fr.espheria.bean.UtilisateurBean         - getSelectedUser !
    INFO: 22:07:06.718 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:07:06.718 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:07:06.730 TRACE [http-thread-pool-8080(5)] fr.espheria.bean.UtilisateurBean         - getSelectedUser !
    INFO: 22:07:06.731 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:07:06.731 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:07:06.741 TRACE [http-thread-pool-8080(5)] fr.espheria.bean.UtilisateurBean         - getSelectedUser !
    INFO: 22:07:06.741 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:07:06.752 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:07:06.753 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:07:06.763 TRACE [http-thread-pool-8080(5)] fr.espheria.bean.UtilisateurBean         - getSelectedUser !
    INFO: 22:07:06.763 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    INFO: 22:07:06.774 DEBUG [http-thread-pool-8080(5)] fr.espheria.bean.UserBean                - getUser ...
    Z'avez une idée du truc qui fait que mon action se déclenche jamais ??

  2. #2
    Membre actif
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Mai 2010
    Messages
    38
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : Maroc

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mai 2010
    Messages : 38
    Par défaut
    Il faut que tu met l'attribu ajax=false , parcequ'il est true par defaut

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <p:commandeButton ajax="false" .............. />

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    92
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 92
    Par défaut
    Je viens d'essayer cette modification qui ne m'enchante pas, je voudrais faire ça avec ajax, et le résultat est le même, l'action n'est pas touchée, ça m'énerve d'autant plus que c'est basique mais je ne trouve pas l'erreur...
    Merci quand même

  4. #4
    Membre confirmé
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    92
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 92
    Par défaut
    J'ai une piste pour mon problème mais si quelqu'un pouvait confirmer ou m'indiquer une autre manière de faire

    Le <p:commandButton qui ne déclenche pas mon action mais relance bien le chargement de la page, dumoins en partie, est lui-même dans un <p:panel que je fais apparaître avec un selectionlistener et update="id...".
    Ca ne fonctionne pas si le bouton apparait dans un panneau commandé par ajax ?? Comment fait-on ??

Discussions similaires

  1. Deux serveurs sur AIX un fonctionne l'autre non
    Par karimspace dans le forum AIX
    Réponses: 4
    Dernier message: 16/05/2008, 15h26
  2. [VHOSTS] Certains fonctionnent, d'autres non.
    Par Zarnolink dans le forum Apache
    Réponses: 6
    Dernier message: 05/03/2008, 19h40
  3. Réponses: 4
    Dernier message: 10/04/2007, 12h00
  4. installation deux serveurs, un marche l'autre non
    Par Djo00 dans le forum Apache
    Réponses: 3
    Dernier message: 22/08/2006, 16h01
  5. Réponses: 14
    Dernier message: 17/08/2006, 10h29

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo