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 :

commandButton qui ne fonctionne pas


Sujet :

JSF Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Homme Profil pro
    Étudiant
    Inscrit en
    Août 2011
    Messages
    40
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Août 2011
    Messages : 40
    Par défaut commandButton qui ne fonctionne pas
    Bonjour,

    Pour les ajouts, j'aimerais faire des boutons Dialog pour ne pas surcharger les formulaires et le tout dans un Layout. Sauf que <p:commandButton> ne fonctionne pas. A l'extérieur du Layout, ça fonctionne.

    La page html :
    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
    <!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:f="http://java.sun.com/jsf/core"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:p="http://primefaces.org/ui">
     
        <ui:composition template="/Views/Template/common.xhtml">
        <ui:define name="Edition">
        <h:form id="form">
            <p:growl id="msgs" />
            <p:panel header="Nouveau">
                <h:panelGrid columns="2" id="grid">
                <h:outputLabel value="ID : *" for="txt_id" />
                    <p:inputText id="txt_id" value="#{typeCarburantBean.typeCarburant.idCarburant}"
                        required="true" />
                    <h:outputLabel value="Libelle : *" for="txt_lib" />
                    <p:inputText id="txt_lib" value="#{typeCarburantBean.typeCarburant.libelle}"
                        required="true" />
     
                    <h:outputLabel value="prix : *" for="txt_prix" />
                    <p:inputText id="txt_prix" required="true"
                        value="#{typeCarburantBean.typeCarburant.prixLitre}" />
     
                     <p:commandButton value="Reset" type="reset" />
                    <p:commandButton id="btn_add" value="AJOUT"
                        action="#{typeCarburantBean.addTypeCarburant}" />
                </h:panelGrid>
            </p:panel>
        </h:form>
        </ui:define>
        <ui:define name="Consultation">
     
         <h:form id="AjoutP">
                <p:commandButton value="Ajouter un Vehicule" icon="ui-icon-adds"   onclick="CarburantAjout.show()"/>
            </h:form>
                    <h:form id="edit">
     
                <p:dialog header="Ajout un Vehicule" widgetVar="CarburantAjout" resizable="true" id="editP" >
     <p:growl id="growl" showDetail="true" sticky="false" />
     
                    <h:panelGrid id="display" columns="2" cellpadding="4" style="margin:0 auto;">
     
     
                        <f:facet name="header">
                            <h:outputLabel value="bonjour"/>
                        </f:facet>
     
     
     
                        <h:outputLabel for="id" title="id" value="id:" style="color: crimson;" />
                        <h:inputText value="#{typeCarburantBean.typeCarburant.idCarburant}"  id="id" required="true"/>
                        <h:outputLabel for="libelle"  value="libelle:" style="color: crimson;"/>
                        <h:inputText value="#{typeCarburantBean.typeCarburant.libelle}"  id="libelle" required="true"/>
                        <h:outputLabel for="prix" title="prix" value="prix" style="color: crimson;"/>
     
                        <h:inputText value="#{typeCarburantBean.typeCarburant.prixLitre}"   id="prix" required="true"/>
     
                    </h:panelGrid>
                    <p:separator/>
                    <p:commandButton value="Enregistrer" actionListener="#{typeCarburantBean.addTypeCarburant}"  oncomplete="CarburantAjout.hide()"  />
                </p:dialog>
                </h:form>
         <h:form id="tbb"> 
     
     
                  <p:outputPanel>  
                       <h:outputText value="Search:" style="Height:30px"/>  
                       <p:inputText id="globalFilter" onkeyup="TypeCarburant.filter()" style="width:150px" />  
                  </p:outputPanel>  
            <p:dataTable id="dataTable" var="typeCarburant" value="#{typeCarburantBean.alltype}" sortMode="single" rows="5" paginator="true">    
     
                <p:column sortBy="#{typeCarburant.idCarburant}" headerText="ID" >  
                    <h:outputText value="#{typeCarburant.idCarburant}" />  
                </p:column>  
     
                <p:column sortBy="#{typeCarburant.libelle}" headerText="Libelle">  
                    <h:outputText value="#{typeCarburant.libelle}" />  
                </p:column>  
     
                <p:column sortBy="#{typeCarburant.prixLitre}" headerText="prix par litre">  
                    <h:outputText value="#{typeCarburant.prixLitre}" />  
                </p:column> 
     
            </p:dataTable>  
     
        </h:form>  
        </ui:define>
     
        </ui:composition>
    </html>
    le bean
    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
    package project.beans;
     
     
    import java.util.List;
     
    import javax.faces.bean.ViewScoped;
     
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.context.annotation.Scope;
    import org.springframework.stereotype.Component;
     
    import project.metier.mouse.TypeCarburant;
    import project.service.TypeCarburantService;
     
    @Component
    @ViewScoped
    //@ManagedBean(name="carb")
    public class TypeCarburantBean {
        private TypeCarburant typeCarburant;
        private TypeCarburantService carburantService;
     
     
     
        public TypeCarburantBean(){
            typeCarburant=new TypeCarburant();
     
        }
     
     
        public  List<TypeCarburant> getAlltype(){
            return carburantService.getAlltype();
     
            }
        public String editCarburant(){
     
            return "new_carburant";
        }
     
        public String newCarburant(){
            reinit();
            return "new_carburantr";
        }
     
        public void reinit(){
            typeCarburant=new TypeCarburant();
        }
        /*
         * public String editPerson(){
            return "new_person";
        }
     
        public String newPerson(){
            reinit();
            return "new_personr";
        }
     
        public void reinit() {
            person = new Person();
        } 
         * 
         */
     
        public void addTypeCarburant(){
            carburantService.addTypeCarburant(typeCarburant);
        }
     
        public TypeCarburant getTypeCarburant() {
            return typeCarburant;
        }
     
        public void setTypeCarburant(TypeCarburant typeCarburant) {
            this.typeCarburant = typeCarburant;
        }
     
        @Autowired
        public void setCarburantService(TypeCarburantService carburantService) {
            this.carburantService = carburantService;
        }
    }
    Quelqu'un saurait-il m'indiquer comment faire ?

    Merci d'avance pour votre aide.

  2. #2
    Membre actif
    Profil pro
    Inscrit en
    Avril 2013
    Messages
    93
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2013
    Messages : 93
    Par défaut
    Si ton projet n'est pas confidentiel, peux tu nous le donner en pièce jointe ?
    Il manque pas mal d'informations qui peuvent être utiles pour comprendre le pb

Discussions similaires

  1. Code qui ne fonctionne pas sur Mac
    Par malbaladejo dans le forum Général JavaScript
    Réponses: 4
    Dernier message: 14/01/2005, 11h08
  2. [SQL] Requête à jointure qui ne fonctionne pas
    Par Bensor dans le forum Langage SQL
    Réponses: 2
    Dernier message: 09/12/2004, 16h10
  3. Jointure externe qui ne fonctionne pas
    Par Guizz dans le forum Langage SQL
    Réponses: 3
    Dernier message: 05/02/2004, 12h26
  4. CREATEFILEMAPPING qui ne fonctionne pas???
    Par Jasmine dans le forum MFC
    Réponses: 2
    Dernier message: 06/01/2004, 19h33
  5. UNION qui ne fonctionne pas
    Par r-zo dans le forum Langage SQL
    Réponses: 7
    Dernier message: 21/07/2003, 10h04

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