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 :

[PrimaFaces] Récupérer la valeur du champ d'un formulaire [Débutant(e)]


Sujet :

JSF Java

  1. #1
    Candidat au Club
    Homme Profil pro
    Architecte de système d'information
    Inscrit en
    Février 2015
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Architecte de système d'information
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Février 2015
    Messages : 11
    Points : 3
    Points
    3
    Par défaut [PrimaFaces] Récupérer la valeur du champ d'un formulaire
    Bonjour,

    Je suis débutant en développement web et je suis en en train de développer un tableau de bord en utilisant le JSF 2.8 avec PrimeFaces.

    J'ai du problème pour récupérer la valeur du champ d'un formulaire en utilisant une servlet ou un ManagedBean.

    Quelqu'un saurait-il me guider un peu ?

    Merci d'avance pour votre aide.

  2. #2
    Membre averti
    Avatar de stc074
    Homme Profil pro
    Codeur du dimanche
    Inscrit en
    Janvier 2009
    Messages
    1 015
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : France, Lozère (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Codeur du dimanche

    Informations forums :
    Inscription : Janvier 2009
    Messages : 1 015
    Points : 407
    Points
    407
    Billets dans le blog
    1
    Par défaut
    Citation Envoyé par aigledecarthage Voir le message
    Bonjour,

    Je suis débutant en développement web et je suis en en train de développer un tableau de bord en utilisant le JSF 2.8 avec PrimeFaces.

    J'ai du problème pour récupérer la valeur du champ d'un formulaire en utilisant une servlet ou un ManagedBean.

    Quelqu'un saurait-il me guider un peu ?

    Merci d'avance pour votre aide.
    il faut utiliser l'attribut value du champ dans lequel tu mets un attribut du managedBean :
    par exemple :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    <p:inputText id="name" value="#{managedBean.valeur}" />
    sachant que valeur est un attribut du managedBean ManagedBean et qu'il doit posséder un getter et un setter.

    à la soumission du formulaire tu aura accès à la valeur dans ton managed bean via la propriété valeur.

  3. #3
    Modérateur
    Avatar de OButterlin
    Homme Profil pro
    Inscrit en
    Novembre 2006
    Messages
    7 311
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7 311
    Points : 9 524
    Points
    9 524
    Billets dans le blog
    1
    Par défaut
    Citation Envoyé par aigledecarthage Voir le message
    J'ai du problème pour récupérer la valeur du champ d'un formulaire en utilisant une servlet ou un ManagedBean.
    Que veux-tu dire ?
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  4. #4
    Candidat au Club
    Homme Profil pro
    Architecte de système d'information
    Inscrit en
    Février 2015
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Architecte de système d'information
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Février 2015
    Messages : 11
    Points : 3
    Points
    3
    Par défaut
    Je voudrais récupérer les valeurs des champs d'un formulaire et les envoyer à travers un button submit en tant que des paramètres d'une méthode qui exécute une requête SQL. je voudrais savoir comment récupérer les champs de mon formulaire à traves un managed beans (ou bien servlets httprequest).

    Code html : 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
    <div align="center">
                <h:form> 
                    <table> 
     
                        <tr>
                           <td> <p:outputLabel value="Code entite: " />
                           </td>
                            <td>
                                <p:inputText     value="#{man.codsoc}"  />
                            </td>
                        </tr>
     
     
                      <tr>                     
                          <td><p:outputLabel for="button" value="Date de début: " /></td>
                          <td><p:calendar pattern="yyyyMMdd"   id="button"   required="true" requiredMessage="Veuillez saisie la date de début"   value="#{man.calendarView.date4}" showOn="button" />
                             </td>
                       </tr>
     
     
                        <tr>
                           <td> <p:outputLabel value="Code Projet: " />
                           </td>
                            <td>
                                <p:inputText     value="#{man.pro}"  />
                            </td>
                        </tr>
                   <tr>
                       <td>
                  <div align="center"><p:commandButton value="Submit" action="CFpP.xhtml"   icon="ui-icon-star" /></div></td>
                   </tr>
     
                    </table>
                </h:form>     
            </div>
          <p:separator/>
            <div align="center">
                <h:form>

    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
    import ChartDirector.DBTable;
    import classes.ConnexionBD;
    import classes.fournisseur;
    import static com.sun.xml.fastinfoset.alphabet.BuiltInRestrictedAlphabets.table;
    import java.util.ArrayList;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.RequestScoped;
     
    /**
     *
     * @author 09775019
     */
    @ManagedBean(name="man")
    @RequestScoped
    public class Man extends ConnexionBD   {
     
        /**
         * Creates a new instance of Man
         */
        public Man() {  
        }
     
         private String codsoc;
          private String button;
        private String name;
        private String codpro;
     
     
     
        public String getCodesoc() {
            return codsoc;
        }
     
        public void setCodesoc(String codsoc) {
            this.codsoc = codsoc;
        }
     
        public String getButton() {
            return button;
        }
     
        public void setButton(String button) {
            this.button = button;
        }
     
        public String getName() {
            return name;
        }
     
        public void setName(String name) {
            this.name = name;
        }
     
        public String getPro() {
            return codpro;
        }
     
        public void setcodPro(String codpro) {
            this.codpro = codpro;
        }
    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
       fournisseur F   =  new fournisseur();
        ArrayList<String> ListcodeSociete = F.ListcodeSociete(codsoc);   
     
    	ConnexionBD con   = new ConnexionBD();
          DBTable table  = F.CommFournisseur(codsoc,button,name,codpro);
     
     
    	 String SQL = "exec .[].[ PRCEDURE SQL effacer  ]'""','"+button+"','"+name+"','"+codpro+"'";           
     
           table   =   new DBTable(con.getResultSet(SQL));
                    String[] TCE  = table.getColAsString(0);
    	        String[] TD   = table.getColAsString(1);
    	        String[] TCF  = table.getColAsString(2);
    	        String[] TF   = table.getColAsString(3);				 
    	        String[] TNC  = table.getColAsString(4);
                    String[] TLC  = table.getColAsString(5);
    	        String[] TDC  = table.getColAsString(6);
                    String[] TCA  = table.getColAsString(7);
    	        String[] TDE  = table.getColAsString(8);
    	        String[] TQT  = table.getColAsString(9);

  5. #5
    Modérateur
    Avatar de OButterlin
    Homme Profil pro
    Inscrit en
    Novembre 2006
    Messages
    7 311
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7 311
    Points : 9 524
    Points
    9 524
    Billets dans le blog
    1
    Par défaut
    Et bien c'est le cas standard d'utilisation, ton managedBean à des propriétés exposées par des getter/setter, ta page y fait référence.
    L'action associée à ton bouton de commande fait partie du managedBean, elle aura donc accès à toutes les propriétés.
    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
     
    class MonBean
    {
       private String code;
       private Integer type;
     
       public String getCode()
       {
          return code;
       }
       public void setCode(String code)
       {
          this.code = code;
       }
    ...
       public String processCommand()
       {
          // ici, tu fais ce que tu as à faire avec code, type etc...
       }
    La page
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    ...
    <p:inputText value="#{monBean.code}"/>
    <p:inputText value="#{monBean.type}"/>
     
    <p:commandButton value="Executer" action="#{monBean.processCommand()}"/>
    ...
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  6. #6
    Candidat au Club
    Homme Profil pro
    Architecte de système d'information
    Inscrit en
    Février 2015
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Architecte de système d'information
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Février 2015
    Messages : 11
    Points : 3
    Points
    3
    Par défaut
    encore sans succès

  7. #7
    Candidat au Club
    Homme Profil pro
    Architecte de système d'information
    Inscrit en
    Février 2015
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Architecte de système d'information
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Février 2015
    Messages : 11
    Points : 3
    Points
    3
    Par défaut quelqu'un peux me corriger ?
    Nom : f.png
Affichages : 2196
Taille : 24,8 Ko

  8. #8
    Candidat au Club
    Homme Profil pro
    Architecte de système d'information
    Inscrit en
    Février 2015
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Architecte de système d'information
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Février 2015
    Messages : 11
    Points : 3
    Points
    3
    Par défaut voila mon 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
    */
    package controlleur;
     
    import ChartDirector.DBTable;
    import classes.ConnexionBD;
    import classes.departements;
    import classes.fournisseur;
    import java.sql.SQLException;
    import java.util.ArrayList;
    import java.util.Map;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.faces.bean.ManagedBean;
    import javax.faces.bean.RequestScoped;
    import javax.faces.context.FacesContext;
     
     
    @ManagedBean(name="t")
    @RequestScoped
    public class t  extends ConnexionBD{
     
        public t() {
        }
     
     
     
      public  String cod;
     
     
        public String getCod() {
            return cod;
        }
     
        public void setCod(String cod) {
            this.cod = cod;
        }
     
     
          Map<String, String> params =FacesContext.getCurrentInstance().
                       getExternalContext().getRequestParameterMap();
                String act = params.get("cod"); 
     
     
     
      public  String processCommand( String act ) {
     
            try {
              departements F   =  new departements();
     
     
                ConnexionBD con   = new ConnexionBD();
                DBTable table  = F.departementes(act);
     
     
                String SQL =  "select CodeDepartement, CodeSociete , Departement, CodeActivite " 
    	                       +",Consolidation from dimensions..departements where"
    	                       +"(CodeSociete ='"+ act +"')";
     
                table   =   new DBTable(con.getResultSet(SQL));
     
                String[] TCE   = table.getColAsString(0);
                String[] TDe   = table.getColAsString(1);
                String[] TCF   = table.getColAsString(2);
                String[] TF    = table.getColAsString(3);
     
            } catch (SQLException ex) {
                Logger.getLogger(Man.class.getName()).log(Level.SEVERE, null, ex);
            }
            return null;
             }
        }

  9. #9
    Candidat au Club
    Homme Profil pro
    Architecte de système d'information
    Inscrit en
    Février 2015
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Architecte de système d'information
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Février 2015
    Messages : 11
    Points : 3
    Points
    3
    Par défaut voila ma 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
    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
    <?xml version='1.0' encoding='UTF-8' ?>
    <!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:ui="http://java.sun.com/jsf/facelets"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:p="http://primefaces.org/ui">
        <h:head>
            <title>TB Commade par founisseur</title>
               <style>
     
                 .t{background-image: radial-gradient }   
     
               </style>    
        </h:head>
        <body>
            <div align="center">
            <h:form>
                <table>
     
                           <tr>
                               <td> 
                                 <p:outputLabel    value="code " />
                               </td>
                               <td>
                                 <p:inputText   id="cod" value="#{t.cod}"  />
                                 <f:param  name="act"  value="#{t.cod}" />
     
                                </td>
                            </tr>
                          <tr>
                             <div align="center">
                             <p:commandButton value="Executer"  action="#{t.processCommand()}" icon="ui-icon-star" />
                             </div>
                         </tr>
                </table>   
            </h:form>
            </div>
            <separator />
            <p:dataTable var="b" value="#{dtBasicView.t}">
        <p:column headerText="Id">
            <h:outputText value="#{b.TCE}" />
        </p:column>
     
        <p:column headerText="Year">
            <h:outputText value="#{b.TDe}" />
        </p:column>
     
        <p:column headerText="Brand">
            <h:outputText value="#{b.TCF}" />
        </p:column>
     
        <p:column headerText="Color">
            <h:outputText value="#{b.TF}" />
        </p:column>
    </p:dataTable>
     
     
     
     
        </body> 
    </html>

  10. #10
    Candidat au Club
    Homme Profil pro
    Architecte de système d'information
    Inscrit en
    Février 2015
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Architecte de système d'information
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Février 2015
    Messages : 11
    Points : 3
    Points
    3
    Par défaut login jsf primafaces
    bonjour
    j'ai du probleme a utiliser un login en ultilisant le jsf et primafaces
    voila le code

    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
    </h:form    >
        <p:growl id="growl" sticky="true" showDetail="true" life="3000" />
        <p:dialog header="Login" widgetVar="dlg" resizable="true"   position="20,50"  >
            <h:panelGrid columns="2" cellpadding="5">
                <h:outputLabel for="username" value="Username:"   size="5" />
                <p:inputText id="username" value="#{loginadmin.username}" required="true" label="username" size="7"  maxlength="15" />
     
                <h:outputLabel for="password" value="Password:"   size="5" />
                <p:password id="password" value="#{loginadmin.password}" required="true" label="password"  size="7"  maxlength="15" />
     
                <f:facet name="footer">
                    <p:commandButton value="Login" update="growl" actionListener="#{loginadmin.login}"  
     
                                     oncomplete="handleLoginRequest(xhr, status, args)"   style="margin-right:20px;"   />
                </f:facet>  
            </h:panelGrid>
        </p:dialog>
    </h:form>
    <script type="text/javascript">
        function handleLoginRequest(xhr, status, args) {
            if(args.validationFailed || !args.loggedIn) {
                PF('dlg').jq.effect("shake", {times:5}, 100);
            }
            else {
                PF('dlg').hide();
                $('#loginLink').fadeOut();
            }
        }
    </script>

  11. #11
    Membre régulier
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Janvier 2015
    Messages
    87
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Janvier 2015
    Messages : 87
    Points : 117
    Points
    117
    Par défaut
    Citation Envoyé par aigledecarthage Voir le message
    bonjour
    j'ai du probleme a utiliser un login en ultilisant le jsf et primafaces
    voila le code

    </h:form >
    <p:growl id="growl" sticky="true" showDetail="true" life="3000" />
    <p:dialog header="Login" widgetVar="dlg" resizable="true" position="20,50" >
    <h:panelGrid columns="2" cellpadding="5">
    <h:outputLabel for="username" value="Username:" size="5" />
    <p:inputText id="username" value="#{loginadmin.username}" required="true" label="username" size="7" maxlength="15" />

    <h:outputLabel for="password" value="Password:" size="5" />
    <p:password id="password" value="#{loginadmin.password}" required="true" label="password" size="7" maxlength="15" />

    <f:facet name="footer">
    <p:commandButton value="Login" update="growl" actionListener="#{loginadmin.login}"

    oncomplete="handleLoginRequest(xhr, status, args)" style="margin-right:20px;" />
    </f:facet>
    </h:panelGrid>
    </p:dialog>
    </h:form>
    <script type="text/javascript">
    function handleLoginRequest(xhr, status, args) {
    if(args.validationFailed || !args.loggedIn) {
    PF('dlg').jq.effect("shake", {times:5}, 100);
    }
    else {
    PF('dlg').hide();
    $('#loginLink').fadeOut();
    }
    }
    </script>


    je vois que vous êtes débutant et devant beaucoup des problème et même tu n'arrive pas à résoudre des chose qui sont standard en jsf . si tu besoin d'aide tu peux me communiquer en prive et je peux te donne des exemples des projets en marche pour les suivre

  12. #12
    Candidat au Club
    Homme Profil pro
    Architecte de système d'information
    Inscrit en
    Février 2015
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Architecte de système d'information
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Février 2015
    Messages : 11
    Points : 3
    Points
    3
    Par défaut
    je suis entrain de développer (jsf ,primfaces ,java)
    un tableau de bord en passant un datedebut et datefin en parametre

    je me trouve bloquer devant message d'erreur

    Cannot format given Object as a Date

  13. #13
    Membre averti
    Avatar de stc074
    Homme Profil pro
    Codeur du dimanche
    Inscrit en
    Janvier 2009
    Messages
    1 015
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : France, Lozère (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Codeur du dimanche

    Informations forums :
    Inscription : Janvier 2009
    Messages : 1 015
    Points : 407
    Points
    407
    Billets dans le blog
    1
    Par défaut
    Citation Envoyé par aigledecarthage Voir le message
    je suis entrain de développer (jsf ,primfaces ,java)
    un tableau de bord en passant un datedebut et datefin en parametre

    je me trouve bloquer devant message d'erreur

    Cannot format given Object as a Date
    si ton champ est une date, le value doit contenir un Objet Date.

  14. #14
    Candidat au Club
    Homme Profil pro
    Architecte de système d'information
    Inscrit en
    Février 2015
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Architecte de système d'information
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Février 2015
    Messages : 11
    Points : 3
    Points
    3
    Par défaut voila mon code page 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
    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
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    <html xmlns="http://www.w3.org/1999/xhtml"
        xmlns:ui="http://java.sun.com/jsf/facelets"
        xmlns:h="http://java.sun.com/jsf/html"
        xmlns:f="http://java.sun.com/jsf/core"
        xmlns:p="http://primefaces.org/ui">
     <h:head>
            <title>Facelet Title</title>
        </h:head>
        <h:body>  
     
     <div align="center">
     
      <p:fieldset  style="width:300px ; font-family:Times New Roman, Times, serif; "     legend="Tva Colllecté" toggleable="true" toggleSpeed="300">
     
      <h:form id="for">
       <p:panelGrid columns="2"  style="font-size:15px"  >
        <p:outputLabel name="for"  style="width:100px"    value="Entite" />
         <p:inputText id="ent"  value="#{tableau.entite}" />
     
           <p:outputLabel   name="for" value="Année début" style="width:100px"   />
              <p:calendar id="debut"  pattern="yyyyMMdd"    value="#{tableau.annedebut}" >
     
              </p:calendar>
     
            <p:outputLabel  style="width:100px"   name="for" value="Année fin"/>
                 <p:calendar  id="fin" pattern="yyyyMMdd"   value="#{tableau.annefin}"  >
     
                </p:calendar>
     
        <f:facet name="footer">
     
          <p:commandButton  icon="ui-icon-search"  value="Envoyer"  action="TvaCollecte.xhtml?faces-redirect=true" >
     
         </p:commandButton> 
           </f:facet>
        </p:panelGrid>
      </h:form>
        </p:fieldset >
     
     
     </div>
     
     
      <br />
     
     <div align="center">
     <h:form  id="form" >
     
        <p:dataTable  id="table" var="tva" value="#{tableau.tvaCollecte}" rows="7"
                             paginator="true"
     
                             paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                             rowsPerPageTemplate="5,10,50"  style="font-size:13px ;width:800px ;size:10px ; font-family:Times New Roman "   >
     
     
                   <f:facet name="header"> 
                       <p:commandButton id="toggler" type="button" value="Columns"
                           style="float:left" icon="ui-icon-calculator"   />
                              <p:columnToggler datasource="table" trigger="toggler" />
                            Tableux Des Tva Collecté Poulina PGH
                            <br />
                               <h:commandLink>
                                  <p:graphicImage value="/resources/css/téchar/excel.jpg"  width="24" />
                                  <p:dataExporter type="xls" target="table" fileName="Tva Collecte" pageOnly="false"  />
                               </h:commandLink>
     
                                  <h:commandLink>
                                <p:graphicImage value="/resources/css/téchar/pdf.png"  width="24" />
                              <p:dataExporter type="pdf" target="table" fileName="Tva Collecte" pageOnly="false"    />
                               </h:commandLink>
     
                              <h:commandLink>
                                  <p:graphicImage value="/resources/css/téchar/csv1.png"  width="24"/>
                                   <p:dataExporter type="csv" target="table" fileName="Tva Collecte" pageOnly="false"  />
                              </h:commandLink>   
     
     
     
                     </f:facet> 
     
            <p:column style="width:24px">
                <p:commandLink update=":form:panel" oncomplete="PF('documentDialog').show()" title="View Detail" styleClass="ui-icon ui-icon-search">
                    <f:setPropertyActionListener value="#{tva}" target="#{tableau.selectedTableau}" />
                </p:commandLink>
            </p:column>
     
                <p:column headerText="Code entite">
                <h:outputText value="#{tva.codeentite}" />
                </p:column>
     
                 <p:column headerText="Description">
                <h:outputText value="#{tva.description}" />
                </p:column>
     
                <p:column  filterBy="#{tva.designation}"   headerText="Désignation">
                <h:outputText value="#{tva.designation}" />
                </p:column>
     
                <p:column headerText="Taux">
                <h:outputText value="#{tva.taux}" />
                </p:column>
     
     
                <p:column headerText="MHT">
                <h:outputText value="#{tva.montant}" />
                </p:column>
     
                <p:column headerText="Tva">
                <h:outputText value="#{tva.tva}" />
                </p:column>
     
                <p:column headerText="Fodec">
                <h:outputText value="#{tva.fodec}" />
                </p:column>
     
                 <p:column headerText="Av">
                <h:outputText value="#{tva.av}" />
                </p:column>
     
      </p:dataTable>
     
      <!--  
      <p:dialog  header="Commande Num: #{car.numcde}" showEffect="fade" Style="font-size:10px "   widgetVar="documentDialog"  modal="true" hideEffect="explode" resizable="false">
            <p:outputPanel id="panel" >
                <p:panelGrid  columns="2" >
     
                     <h:outputLabel  value="Code entite " />
                     <h:outputText   value="#{tableau.selectedTableau.codeentite}" style="font-weight:bold" />
     
                     <h:outputLabel  value="Departement " />
                     <h:outputText   value="#{tableau.selectedTableau.departement}" style="font-weight:bold" />
     
                     <h:outputLabel  value="Numbr " />
                     <h:outputText   value="#{tableau.selectedTableau.numbr}" style="font-weight:bold" />
     
                     <h:outputLabel  value="Code fournisseur " />
                     <h:outputText   value="#{tableau.selectedTableau.codefournisseur}" style="font-weight:bold" />
     
                     <h:outputLabel  value="Fournisseur " />
                     <h:outputText   value="#{tableau.selectedTableau.fournisseur}" style="font-weight:bold" />
     
                     <h:outputLabel  value="Date Reception" />
                     <h:outputText   value="#{tableau.selectedTableau.datereception}" style="font-weight:bold" />
     
                     <h:outputLabel  value="Num Commande " />
                     <h:outputText   value="#{tableau.selectedTableau.numcde}"  style="font-weight:bold"/>
     
     
                     <h:outputLabel  value="Acheteur" />
                     <h:outputText   value="#{tableau.selectedTableau.acheteur}" style="font-weight:bold" />
     
     
                     <h:outputLabel  value="Compte achat"  />
                     <h:outputText   value="#{tableau.selectedTableau.compteachat}"  style="font-weight:bold"   />
     
     
                     <h:outputLabel  value="Montant"  />
                     <h:outputText   value="#{tableau.selectedTableau.montant}"  style="font-weight:bold"   />
     
     
     
                     <h:outputLabel  value="Type Fournisseur"  />
                     <h:outputText   value="#{tableau.selectedTableau.typefournisseur}"  style="font-weight:bold"   />
     
     
                     <h:outputLabel  value="Date Chargement"  />
                     <h:outputText   value="#{tableau.selectedTableau.datechargement}"  style="font-weight:bold"   />
     
     
     
                </p:panelGrid>
            </p:outputPanel>
        </p:dialog>
        -->
     
        <p:blockUI block="table" trigger="table">
                  LOADING<br />
               <p:graphicImage name="./images/ajax-loader1.gif"/>
     
        </p:blockUI> 
     
     
     
    </h:form>
     
      </div>
       </h:body>
     
     
     
    </html>

  15. #15
    Candidat au Club
    Homme Profil pro
    Architecte de système d'information
    Inscrit en
    Février 2015
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Architecte de système d'information
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Février 2015
    Messages : 11
    Points : 3
    Points
    3
    Par défaut mon 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
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    public static String  ent;
    	 public static String  debut;
    	 public static String  fin;
     
     
     
    	public static String annefin;
     
     
     
     
    	public static String annedebut;
     
     
    	public String getAnnefin() {
    		return annefin;
    	}
     
     
    	public void setAnnefin(String annefin) {
    		this.annefin = annefin;
    	}
     
     
    	public String getAnnedebut() {
    		return annedebut;
    	}
     
     
    	public void setAnnedebut(String annedebut) {
    		this.annedebut = annedebut;
    	}
     
     
     
     
     
     
    	public ArrayList<Tableau> getTvaCollecte() {
    		  return gettva();
    		}
     
     
     
    public static ArrayList<Tableau> gettva() {
    	    try {
     
    	    	//SimpleDateFormat fmt = new SimpleDateFormat("yyyyMMdd");
    	    	 // String debut = fmt.format(annedebut);
    	    	//String fin = fmt.format(annefin);
     
     
     
    	  	    System.out.println(" paramtere  1  avant saisie   -->" + ent);
    	        System.out.println(" paramtere  2  avant saisie   -->" + debut);
    	    	System.out.println(" paramtere  3  avant saisie   -->" + fin);
     
     
     
     
    	        Connection con = Database.getConnection();
    	        PreparedStatement ps = con.prepareStatement("exec   procedure "
    	        		            +  "@codeentite='?',"
    	        		            +  "@debut='?',"
    	        		            +  "@fin='?'");
     
     
    	          ps.setString(1, ent);
    	          ps.setString(2, debut);
    	          ps.setString(3, fin);
     
     
    	        ArrayList<Tableau> aln = new ArrayList<Tableau>();
    	        ResultSet rs = ps.executeQuery();
    	        boolean found = false;
    	        while (rs.next()) {
    	        	Tableau f = new Tableau();
     
    	            f.setCodeentite(rs.getString("Codeentite"));
    	            f.setDescription(rs.getString("Description"));
    	            f.setDesignation(rs.getString("Designation"));
    	            f.setTaux(rs.getString("Taux"));
    	            f.setMht(rs.getString("Mht"));
    	            f.setTva(rs.getString("Tva"));
    	            f.setFodec(rs.getString("fodec"));
    	            f.setAv(rs.getString("Av"));
     
     
    	         aln.add(f);
     
    	              found = true;
    	        }
    	        rs.close();
    	        if (found) {
    	            return aln;
    	        } else {
    	            return null; // no entires found
    	        }
    	    } catch (Exception e) {
    	        System.out.println("Error In tva collecte () -->" + e.getMessage());
    	        return (null);
    	    }}

  16. #16
    Membre averti
    Avatar de stc074
    Homme Profil pro
    Codeur du dimanche
    Inscrit en
    Janvier 2009
    Messages
    1 015
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : France, Lozère (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Codeur du dimanche

    Informations forums :
    Inscription : Janvier 2009
    Messages : 1 015
    Points : 407
    Points
    407
    Billets dans le blog
    1
    Par défaut
    essaie avec :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    private Date datedebut;
    private Date dateFin;
    + les accesseurs.

  17. #17
    Candidat au Club
    Homme Profil pro
    Architecte de système d'information
    Inscrit en
    Février 2015
    Messages
    11
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Architecte de système d'information
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Février 2015
    Messages : 11
    Points : 3
    Points
    3
    Par défaut
    pas encore, j'ai changé mais sans succées

  18. #18
    Membre averti
    Avatar de stc074
    Homme Profil pro
    Codeur du dimanche
    Inscrit en
    Janvier 2009
    Messages
    1 015
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 49
    Localisation : France, Lozère (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Codeur du dimanche

    Informations forums :
    Inscription : Janvier 2009
    Messages : 1 015
    Points : 407
    Points
    407
    Billets dans le blog
    1
    Par défaut
    Citation Envoyé par aigledecarthage Voir le message
    pas encore, j'ai changé mais sans succées
    Regardes les messages d'erreurs des log dans ton ide, ça te mettra sur la voie.

Discussions similaires

  1. Réponses: 1
    Dernier message: 15/11/2012, 19h33
  2. [MySQL] Je veux récupérer la valeur des champs de ma base et je n'ai qu'1 seul caractère
    Par yiuche dans le forum PHP & Base de données
    Réponses: 15
    Dernier message: 03/08/2006, 17h05
  3. Récupérer la valeur des champs calculés dans une requète SQL dans vba
    Par FrédéricCM dans le forum Requêtes et SQL.
    Réponses: 12
    Dernier message: 28/06/2006, 16h29
  4. Récupérer les valeurs des champs créés dynamiquement
    Par outlawz dans le forum Général JavaScript
    Réponses: 4
    Dernier message: 03/05/2006, 16h32
  5. récupérer la valeur d´un champ d´une popup
    Par naiadeKaren dans le forum Général JavaScript
    Réponses: 3
    Dernier message: 09/08/2005, 16h04

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