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

Servlets/JSP Java Discussion :

A chaque changement de ma base il faut redémarrer TOMCAT


Sujet :

Servlets/JSP Java

  1. #1
    Rédacteur
    Avatar de JauB
    Homme Profil pro
    Freelancer
    Inscrit en
    Octobre 2005
    Messages
    1 792
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Maroc

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

    Informations forums :
    Inscription : Octobre 2005
    Messages : 1 792
    Par défaut A chaque changement de ma base il faut redémarrer TOMCAT
    Bonjour,
    ma page JSP garde les mêmes inforamtions, lorsque j'ajoute par exemple des données dans le base de données et je raffraichis ma page les données ne sont pas là de même lorsque je fais des suppressions et je suis toujours amené à redemarrer TOMCAT pour que les changements effectués dans ma base soient pris en compte dans ma page!
    dois-je changer quelques choses dans ma page JSP ou qu'il faut voir côté TOMCAT?
    merci d'avance
    Mes articles, Mon Blog

    Rubrique Jasper/iReport :
    ------- Forum Jasper --------
    ----- FAQ Jasper/iReport -----


  2. #2
    Membre émérite Avatar de Pollux
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    706
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : Suisse

    Informations forums :
    Inscription : Avril 2005
    Messages : 706
    Par défaut
    Si en redémarrant tomcat tu constates les changements effectués c'est qu'au niveau code db c'est bon.

    Tu as peut-être un cache défini sur ton navigateur. Tu peux définir le comportement du cache dans les en-têtes de ta jsp si jamais.

  3. #3
    Expert éminent
    Avatar de tchize_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Avril 2007
    Messages
    25 482
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 46
    Localisation : Belgique

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Avril 2007
    Messages : 25 482
    Par défaut
    T'es sur de relire ta db à chaque fois ou t'as stocké tes résultat dans une variable statique ou application scope ou session scope que tu ne rafraichi pas. Il y a peu de chance que ce soit un problème de cache navigateur, vérifie plutot la méthode par laquelle tu obtiens tes données et ce que t'en fait.

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

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7 313
    Billets dans le blog
    1
    Par défaut
    Quels sont les paramètres de connexion que tu utilises ?
    Peux-tu également montrer un exemple de code de mise à jour ?

    A+
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  5. #5
    Rédacteur
    Avatar de JauB
    Homme Profil pro
    Freelancer
    Inscrit en
    Octobre 2005
    Messages
    1 792
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Maroc

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

    Informations forums :
    Inscription : Octobre 2005
    Messages : 1 792
    Par défaut
    un bout de code est très parlant, voici comment je procède généralement:
    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
    //page JSP :
     
    <%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ page import="myPackage.Parametrage"%>
    <jsp:useBean id="par" class="myPackage.ParametrageBCK"
    scope="page" />
    <link href="../css/zakoura.css" rel="stylesheet" type="text/css" />
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <%String profil = request.getParameter("profil");%>
    <%request.getSession().setAttribute("profil", profil);%>
    <%par.getMetierByProfil(profil);
    int sizeMenu = par.getParametrage().length;
    Parametrage[] parametrageMenu = new Parametrage[sizeMenu];
    parametrageMenu = par.getParametrage();%>
     
    <SCRIPT LANGUAGE="Javascript">
    var tab;
    var valToHide;
    /** Cette fonction permet d'afficher un menu d'options **/
    function showMenu(arg)
    {
    x=window.event.x;
    y=window.event.y;
    document.getElementById(arg).style.left=x;
    document.getElementById(arg).style.top=y;
    document.getElementById(arg).style.display="";
    <%
    int i = 0;
    String valToHide ;
    /** on doit afficher juste les options du menu cliqué **/
    /** les autres options doivent restées cachées **/
    for (i= 0; i < sizeMenu; i++){
    
    valToHide = parametrageMenu[i].getCdtabl();%>
    valToHide = "<%=valToHide%>";
    
    if (valToHide != arg){
    
    document.getElementById("<%=valToHide%>").style.display = 'none'; 
    } 
    <%}%>
    return false;
    } 
    //...................
     
     
    <table background="table" width="500">
    <%int j;
    for (j = 0; j < sizeMenu; j++) {%>
    <tr>
    <td>
    <a class="menu" href="<%=parametrageMenu[j].getJsp()%>.jsp"
    onclick="javascript:showMenu('<%=parametrageMenu[j].getCdtabl()%>');">
    <%=parametrageMenu[j].getFiller()%><SCRIPT
    language="JavaScript">
    // Ce script permet d'aligner les lignes après le libellé
    var longueur2 = 20 + <%=parametrageMenu[j].getFiller().length()%> ;
    var nbrSpaces2 = 45 - longueur2;
    while (nbrSpaces2 > 0) {document.write('&nbsp;'); nbrSpaces2 = nbrSpaces2 - 1;}
    </SCRIPT></a></td>
    </tr>
    <table id=<%=parametrageMenu[j].getCdtabl()%>
    style="display:'none';position:absolute" class="bulle">
    <%par.getOptionByProfilMetier(profil,parametrageMenu[j].getCdtabl());
    int sizeOption = par.getParametrage().length;
    Parametrage[] parametrageOption = new Parametrage[sizeOption];
    parametrageOption = par.getParametrage();
    %>
    <%int l;
    for (l = 0; l < sizeOption; l++) {%>
    <tr>
    <td><a
    href="http://localhost:8080/sial2/parametrage/<%=parametrageOption[l].getJsp()%>.jsp">
    <%=parametrageOption[l].getFiller()%></a></td>
    </tr>
    <%}%>
    </table>
    </div>
    <%}%>
    </table>
    
    le truc que je fais c'est que j'affiche un menu comme un pop-up sur un lien cliquable. ce menu est constitué de certains liens (que j'appelle des options) que je crée dans ma base de données. quand je crée alors un lien pour ce menu je suis obligé de redémarrer TOMCAT pour que mes options s'ajoutent au menu et qu'elles s'affichent.
    j'éspère que vous avez bien compris ma problèmatique.
    ci-joint un exemple d'exécution pour bien comprendre ce que je cherche à faire.
    dans cet exemple mes options sont :
    Gestion des profils
    Gestion des écrans
    Gestion ....

    et donc quand j'ajoute une autre option par exemple Gestion TRUCS... je suis obligé de redémarrer TOMCAT pour voire cette option nouvellement créée à savoir Gestion TRUCS.
    merci
    Mes articles, Mon Blog

    Rubrique Jasper/iReport :
    ------- Forum Jasper --------
    ----- FAQ Jasper/iReport -----


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

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7 313
    Billets dans le blog
    1
    Par défaut
    Je vois bien ce que tu cherches à faire...
    Peux-tu montrer le code de myPackage.ParametrageBCK ?
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  7. #7
    Rédacteur
    Avatar de JauB
    Homme Profil pro
    Freelancer
    Inscrit en
    Octobre 2005
    Messages
    1 792
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Maroc

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

    Informations forums :
    Inscription : Octobre 2005
    Messages : 1 792
    Par défaut
    ce que j'ao constaté c'est que lorsque je fais une insertion d'une ligne et que je l'affiche alors tout se passe bien, mais si j'essaie d'afficher cette ligne en tant qu'option c'est là où ça bloque et je dois redémarrer TOMCAT.
    sinon pour le code de la classe le voici :
    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
     
    public class ParametrageBCK {
     ParametrageServices parametrageServices;
     Parametrage[] parametrage;
     public Parametrage[] getParametrage() {
      return parametrage;
     }
     public void setParametrage(Parametrage[] parametrage) {
      this.parametrage = parametrage;
     }
     public ParametrageBCK() {
     }
    //  ######################################################################################################
     //IN : null , OUT : liste de tout les metier
     public Parametrage[] getOptionByX(String x,String clx){
      parametrageServices = new ParametrageServices();
      setParametrageByList(parametrageServices.getOptionByX(x,clx));
      return parametrage;
     }
    //  ######################################################################################################
     //IN : null , OUT : liste de tout les metier
     public Parametrage[] getMetier(String profil){
      parametrageServices = new ParametrageServices();
      setParametrageByList(parametrageServices.getXByY("PRFMET", profil));
      return parametrage;
     }
    //  ######################################################################################################
     //IN : profile, OUT : metier du profile envoyé en parametre
     public Parametrage[] getMetierByProfil(String profil){
      parametrageServices = new ParametrageServices();
      setParametrageByList(parametrageServices.getMetierByProfil(profil,"PRFMET"));
      return parametrage;
     }
    //  ######################################################################################################
     // IN : metier, OUT : options du metier envoyé en parametre
     public Parametrage[] getOptionByMetier(String metier){
      parametrageServices = new ParametrageServices();
      setParametrageByList(parametrageServices.getXByY("METOPT",metier));
      return parametrage;
     }
     // ######################################################################################################
     // remplir l'attribut "parametrage" par les elements d'un ecran
     public void getElementsByEcran(String ecran) {
      parametrageServices = new ParametrageServices();
      setParametrageByList(parametrageServices.getElementByEcran(ecran));
     }
     // ######################################################################################################
     // remplir l'attribut "parametrage" par les elements à modifier
     public void getElementToModify(String cltabl, String cdtabl) {
      parametrageServices = new ParametrageServices();
      setParametrageByList(parametrageServices.getXByY(cltabl, cdtabl));
     }
     // ################################################################################################
     // remplir l'attribut "parametrage" par les options d'un profile par ecran
     public void getOptionByProfilMetier(String Profil, String metier) {
      parametrageServices = new ParametrageServices();
      setParametrageByList(parametrageServices.getOptionByProfilMetier(Profil,metier));
     }
     // ################################################################################################
     // remplir l'attribut "parametrage" par les options d'un profile par ecran
     public void getOptionByProfilEcran(String Profil, String ecran) {
      parametrageServices = new ParametrageServices();
      setParametrageByList(parametrageServices.getOptionByProfilEcran(Profil,
        ecran));
     }
     // ###################################################################################################
     // ajoute un Parametrage
     public void ajoutParametrage(String cdtabl, String cltabl, String filler,
       String jsp, String function) {
      parametrageServices = new ParametrageServices();
      parametrageServices.ajoutParametrage(cdtabl, cltabl, filler, jsp,
        function);
     }
     // ######################################################################################################
     // met à jour un Parametrage
     public void modifParametrage(String cdtabl, String cltabl, String filler,
       String jsp, String function) {
      parametrageServices = new ParametrageServices();
      parametrageServices.modifParametrage(cdtabl, cltabl, filler, jsp,
        function);
     }
     // #####################################################################################################
     // remplir l'attribut parametrage par la liste des parametrages repondant
     // aux criteres reçu en parametre
     public void getResearchByCriterias(String cltabl, String cdtabl,
       String filler) {
      String value[] = new String[3];
      String criteria[] = new String[3];
      value[0] = cltabl;
      value[1] = cdtabl;
      value[2] = filler;
      criteria[0] = "cltabl";
      criteria[1] = "cdtabl";
      criteria[2] = "filler";
      parametrageServices = new ParametrageServices();
      setParametrageByList(parametrageServices.getParametrageByCriterias(
        criteria, value, "Parametrage"));
     }
     // ########################################################################################################
     // recupere un tableau de cdtabl et un cdtabl' et crée des lignes de cltabl
     public void setParametrages(String cdtabl, String[] cdtabls, String cltabl,
       String filler, String jsp, String function) {
      parametrageServices = new ParametrageServices();
      //parametrageServices.ajoutParametrage(cdtabl,"OPTION",filler,jsp,function);
      for (int i = 0; i < cdtabls.length; i++) {
       parametrageServices.ajoutParametrage(cdtabls[i]+ cdtabl,cltabl,"", "", "");
      }
     }
     // ########################################################################################################
     // recupere un tableau de cdtabl et un cdtabl' et crée des lignes de cltabl
     public void setParametrages(String[] cdtabls,String cdtabl, String cltabl,
       String filler, String jsp, String function) {
      parametrageServices = new ParametrageServices();
      //parametrageServices.ajoutParametrage(cdtabl,"OPTION",filler,jsp,function);
      for (int i = 0; i < cdtabls.length; i++) {
       parametrageServices.ajoutParametrage(cdtabl+cdtabls[i],cltabl,"", "", "");
      }
     }
     // ######################################################################################################
     // IN : List, OUT : transforme la liste reçu en tableau de type Parametrage
     private void setParametrageByList(List listParametrage) {
      List lst = listParametrage;
      List list = new ArrayList();
      Iterator it = lst.iterator();
      int i = 0;
      while (it.hasNext()) {
       Parametrage par = new Parametrage();
       par = (Parametrage) it.next();
       list.add(i, par);
       i++;
      }
      parametrage = new Parametrage[i];
      for (int j = 0; j < i; j++) {
       Parametrage par = new Parametrage();
       par = (Parametrage) list.get(j);
       parametrage[j] = par;
      }
     }
     // ######################################################################
     //fonction de traitement d'URL
     public String[] getCdstabl(HttpServletRequest request)
     {
      Enumeration eNames= request.getParameterNames(); 
      int i = 0;
     
      List lNames = new ArrayList();
      while (eNames.hasMoreElements()) {
       String str = (String) eNames.nextElement();
       if(request.getParameter(str).equals("on")){
       lNames.add(i,str);
       i++;
       }
      }
     
      Iterator it = lNames.iterator();
      String elements[] =  new String[i];
      int j=0;
     
      while(it.hasNext()){
       elements[j]=(String) it.next();
       j++;
      }
      return elements;
     }
     // ######################################################################
    }
     
    les fonctions citées ne sont pas toutes utilisées dans ma pge JSP mais je vous ai passé tout le code au cas où...
    m'ci :mrgreen:
    Mes articles, Mon Blog

    Rubrique Jasper/iReport :
    ------- Forum Jasper --------
    ----- FAQ Jasper/iReport -----


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

    Informations forums :
    Inscription : Novembre 2006
    Messages : 7 313
    Billets dans le blog
    1
    Par défaut
    Le code de ParametrageServices ?
    (parce que pour le moment, il n'y a pas d'accès à la DB...)
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  9. #9
    Rédacteur
    Avatar de JauB
    Homme Profil pro
    Freelancer
    Inscrit en
    Octobre 2005
    Messages
    1 792
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Maroc

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

    Informations forums :
    Inscription : Octobre 2005
    Messages : 1 792
    Par défaut
    le voici :

    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
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
     
    public class ParametrageServices {
     public ParametrageServices() {
      super();
     }
    //########################################################################################################
    //  IN : un profil , OUT : liste des options attribuées à un profil //
     public List getOptionByProfil(String profil){
      int size = profil.length();
      String req = "select from Parametrage where cltabl ='PRFOPT' and substring(cdtabl, " + size + ")='"+profil+"'";
      System.out.println(req);
      try {
       ParametrageDAO dao= new ParametrageDAO();
       return dao.find(req);
      } catch (HibernateException e) {
     
       e.printStackTrace();
       return null;
      }
     }
    //########################################################################################################
    //  IN : un ecran , OUT : liste des options attribuées à un ecran 
     public List getOptionByEcran(String ecran){
      int size = ecran.length();
      String req = "select  from Parametrage where cltabl ='ECROPT' and substring(cdtabl, " + size + ")='"+ecran+"'";
      System.out.println(req);
      try {
       ParametrageDAO dao= new ParametrageDAO();
       return dao.find(req);
      } catch (HibernateException e) {
     
       e.printStackTrace();
       return null;
      }
     }
    // ########################################################################################################
    //  IN : cltabl & cdtabl , OUT : liste des parametrages pour cltabl la valeur du parametre cltabl et y pour le cdtabl 
     public List getX(String cltabl){
     
      String req = "select  from Parametrage where cltabl ='"+cltabl+"'";
      System.out.println(req);
      try {
       ParametrageDAO dao= new ParametrageDAO();
       return dao.find(req);
      } catch (HibernateException e) {
     
       e.printStackTrace();
       return null;
      }
     }
    //########################################################################################################
    //  IN : cltabl & cdtabl , OUT : liste des parametrages pour cltabl la valeur du parametre cltabl et y pour le cdtabl 
     public List getXByY(String cltabl,String y){
      int size = y.length();
      String req = "select  from Parametrage where cltabl ='"+cltabl+"' and substring(cdtabl,1, " + size + ")='"+y+"'";
      System.out.println(req);
      try {
       ParametrageDAO dao= new ParametrageDAO();
       return dao.find(req);
      } catch (HibernateException e) {
     
       e.printStackTrace();
       return null;
      }
     }
     
    //########################################################################################################
    //  IN : un ecran , OUT : liste des elements de l'ecran envoyé en parametre 
     public List getElementByEcran(String ecran){
      String req = "select  from Parametrage where cltabl ='"+ecran+"'";
      System.out.println(req);
      try {
       ParametrageDAO dao= new ParametrageDAO();
       return dao.find(req);
      } catch (HibernateException e) {
     
       e.printStackTrace();
       return null;
      }
     }
    ///########################################################################################################
    //  IN : rien , OUT : liste de toutes les options 
     public List getOptions()
     {
      String req = "select from Parametrage where cltabl='OPTION'";
      System.out.println(req);
      try {
       ParametrageDAO dao= new ParametrageDAO();
       return dao.find(req);
      } catch (HibernateException e) {
     
       e.printStackTrace();
       return null;
      }
     
     }
    //######################################################################################################## 
    //  IN : un profil & un ecran , OUT : liste des options resultat de l'intersection 
    //   des options attribuées au profil avec les options attribuées à l'ecran 
     public List getOptionByProfilEcran(String profil,String ecran){
     
      int sizeecr=ecran.length();
      int sizeprf=profil.length();
     
      List lstOptEcr=getXByY("ECROPT",ecran);
      List lstOptPrf=getXByY("PRFOPT",profil);
     
      Iterator itoptecr = lstOptEcr.iterator();
      Iterator itoptprf = lstOptPrf.iterator();
     
      Parametrage parecr= new Parametrage();
      Parametrage parprf= new Parametrage();
     
      List lst = new ArrayList();
      int i=0;
      int j=0;
      int k=0;
      while(itoptecr.hasNext())
      {
       parecr=(Parametrage) itoptecr.next();
       while(itoptprf.hasNext())
       {
       parprf=(Parametrage) itoptprf.next();
       if(parprf.getCdtabl().substring(sizeprf).equals(parecr.getCdtabl().substring(sizeecr)))
       {
     
        List lstopt = getXByY("OPTION",parprf.getCdtabl().substring(sizeprf));
        Parametrage param= new Parametrage();
        param =(Parametrage) lstopt.get(0);
        lst.add(k,param);
        k++;
       }
       j++;
       }
       itoptprf = lstOptPrf.iterator();
       i++;
      }
      return lst;
     }
    // ######################################################################################################## 
    //  IN : un profil & un metier , OUT : liste des options resultat de l'intersection 
    //  des options attribuées au profil avec les options attribuées au metier 
     public List getOptionByProfilMetier(String profil,String metier){
     
      System.out.println("profil :"+profil);
      System.out.println("metier :"+metier);
      int sizeecr=metier.length();
      int sizeprf=profil.length();
     
      List lstOptEcr=getXByY("METOPT",metier);
      List lstOptPrf=getXByY("PRFOPT",profil);
     
      Iterator itoptecr = lstOptEcr.iterator();
      Iterator itoptprf = lstOptPrf.iterator();
     
      Parametrage parecr= new Parametrage();
      Parametrage parprf= new Parametrage();
     
      List lst = new ArrayList();
      int i=0;
      int j=0;
      int k=0;
      while(itoptecr.hasNext())
      {
     
       parecr=(Parametrage) itoptecr.next();
       System.out.println(parecr.getCdtabl());
       while(itoptprf.hasNext())
       {
       parprf=(Parametrage) itoptprf.next();
       System.out.println(parprf.getCdtabl());
       if(parprf.getCdtabl().substring(sizeprf).equals(parecr.getCdtabl().substring(sizeecr)))
       {
     
        List lstopt = getXByY("OPTION",parprf.getCdtabl().substring(sizeprf));
        Parametrage param= new Parametrage();
        param =(Parametrage) lstopt.get(0);
        lst.add(k,param);
        k++;
       }
       j++;
       }
       itoptprf = lstOptPrf.iterator();
       i++;
      }
      return lst;
     }
    // ######################################################################################################## 
    //  IN : un cdtabl & un cltabl , OUT : liste des options resultat de l'intersection 
    //  des options attribuées au metier avec les options existants 
     public List getOptionByX(String x,String clx){
       int sizex = x.length();
     
       List lstClx = getXByY(clx,x);
       List lstOpt = getOptions();
     
       Iterator itClx = lstClx.iterator();
       Iterator itOpt = lstOpt.iterator();
     
       List lst = new ArrayList();
       int i=0;
     
       while(itClx.hasNext()){
        Parametrage parClx = (Parametrage) itClx.next();
        while(itOpt.hasNext()){
         Parametrage parOpt = (Parametrage) itOpt.next();
         if(parClx.getCdtabl().substring(sizex).equals(parOpt.getCdtabl())){
          System.out.println(parOpt.getCdtabl());
          lst.add(i,parOpt);
          i++;
         }
     
        } 
        itOpt=lstOpt.iterator();
       } 
      return lst;
     }
    // ######################################################################################################## 
    //  IN : un cdtabl & un cltabl , OUT : liste des options resultat de l'intersection 
    // des options attribuées au metier avec les options existants 
     public List getMetierByProfil(String x,String clx){
       int sizex = x.length();
     
       List lstClx = getXByY(clx,x);
       List lstOpt = getX("METIER");
     
       Iterator itClx = lstClx.iterator();
       Iterator itOpt = lstOpt.iterator();
     
       List lst = new ArrayList();
       int i=0;
     
       while(itClx.hasNext()){
        Parametrage parClx = (Parametrage) itClx.next();
        while(itOpt.hasNext()){
         Parametrage parOpt = (Parametrage) itOpt.next();
         System.out.println("1111" + parOpt.getCdtabl());
         System.out.println("2222"+ parClx.getCdtabl().substring(sizex));
         if(parClx.getCdtabl().substring(sizex).equals(parOpt.getCdtabl())){
          System.out.println(parOpt.getCdtabl());
          lst.add(i,parOpt);
          i++;
         }
     
        } 
        itOpt=lstOpt.iterator();
       } 
      return lst;
     }
    //#############################################################################################
    // ajouter un parametrage
     public void ajoutParametrage(String cdtabl,String cltabl,String filler, String jsp, String function) {
      Parametrage par=new Parametrage();
      par.setCdtabl(cdtabl);
      par.setCltabl(cltabl);
      par.setFiller(filler);
      par.setJsp(jsp);
      par.setFunction(function);
      System.out.println("à été ajouté :"+cdtabl+" "+cltabl);
      try {
       ParametrageDAO dao= new ParametrageDAO();
       dao.save(par);
      } catch (HibernateException e) {
     
       e.printStackTrace();
      }
     
     }
    //###############################################################################
    // mettre à jour un parametrage
     public void modifParametrage(String cdtabl,String cltabl,String filler,String jsp, String function) {
      Parametrage par=new Parametrage();
      par.setCdtabl(cdtabl);
      par.setCltabl(cltabl);
      par.setFiller(filler);
      par.setJsp(jsp);
      par.setFunction(function);
      System.out.println("à été modifié :"+cdtabl+" "+cltabl);
      try {
       ParametrageDAO dao= new ParametrageDAO();
       dao.update(par);
      } catch (HibernateException e) {
     
       e.printStackTrace();
      }
     
     }
    //####################################################################################
    // IN : nom de la table & les champs criteres & valeurs des criteres, OUT : liste resultat
    // de la requete "request" générée par la fonction  
     public List getParametrageByCriterias(String[] criteria,String[] value,String entitie)
     {
      String request = "select from "+entitie;
      String where = " where ";
     
      for(int i=0;i<criteria.length;i++){
       if(value[i]!=""){
        if(i!=0)
         where+="and ";
        where+=criteria[i]+"='"+value[i]+"'";
       }
      }
     
      request+=where;
      System.out.println(request);
      try {
       ParametrageDAO parametrageDAO= new ParametrageDAO();
       return parametrageDAO.find(request);
      } catch (HibernateException e) {
       System.out.println(e.getMessage());
       return null;
      }
     }
    }
    Mes articles, Mon Blog

    Rubrique Jasper/iReport :
    ------- Forum Jasper --------
    ----- FAQ Jasper/iReport -----


  10. #10
    Membre confirmé
    Inscrit en
    Novembre 2007
    Messages
    53
    Détails du profil
    Informations forums :
    Inscription : Novembre 2007
    Messages : 53
    Par défaut
    est ce que au redemerage du tomcat les résultats s'affiche?

  11. #11
    Rédacteur
    Avatar de JauB
    Homme Profil pro
    Freelancer
    Inscrit en
    Octobre 2005
    Messages
    1 792
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Maroc

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

    Informations forums :
    Inscription : Octobre 2005
    Messages : 1 792
    Par défaut
    oui mes données s'affichent bien après redémarrage !!
    je pense que je vais basculer vers JBOSS, je ne pense pas qu'il génére ce genre de problème!
    à mon que j'aie une réponse avant
    Mes articles, Mon Blog

    Rubrique Jasper/iReport :
    ------- Forum Jasper --------
    ----- FAQ Jasper/iReport -----


  12. #12
    Membre Expert
    Profil pro
    Inscrit en
    Août 2006
    Messages
    3 276
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 3 276
    Par défaut
    Ne serait-ce pas du à un problème de transaction non commitée et qui le serait par la force des choses à la coupure de Tomcat ?

  13. #13
    Rédacteur
    Avatar de JauB
    Homme Profil pro
    Freelancer
    Inscrit en
    Octobre 2005
    Messages
    1 792
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 44
    Localisation : Maroc

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

    Informations forums :
    Inscription : Octobre 2005
    Messages : 1 792
    Par défaut
    Citation Envoyé par fr1man Voir le message
    Ne serait-ce pas du à un problème de transaction non commitée et qui le serait par la force des choses à la coupure de Tomcat ?
    non je ne pense pas que ça vienne de cela!car lorsque j'ajoute des lignes toutes simples et que je les affiche alors tout se passe bien, mais quand j'ajoute des lignes à afficher sous forme d'options c'est là que l'obligation de redémarrer TOMCAT se pose.
    et vu que je passe toujours par la même méthode save(Object) alors si le problème venait d'un truc de transaction alors ça l'aurait dans les deux cas et je serais obligé de redémarrer TOMCAT même lorsque j'ajoute de simples données à afficher.
    je creuse encore
    Mes articles, Mon Blog

    Rubrique Jasper/iReport :
    ------- Forum Jasper --------
    ----- FAQ Jasper/iReport -----


Discussions similaires

  1. Réponses: 3
    Dernier message: 08/02/2007, 22h14
  2. reinitialisation d'une session a chaque changement de page
    Par RR instinct dans le forum Langage
    Réponses: 3
    Dernier message: 26/10/2006, 17h09
  3. changement dans la Base de Registre
    Par mikiko dans le forum Windows XP
    Réponses: 6
    Dernier message: 21/06/2006, 21h33
  4. [VBA-E] Excel transfert de cellules à chaque changement de nom
    Par zootman dans le forum Macros et VBA Excel
    Réponses: 2
    Dernier message: 09/06/2006, 10h29
  5. Taille de chaque table dans une base de donnée
    Par Florent PORRAS dans le forum MS SQL Server
    Réponses: 2
    Dernier message: 29/09/2005, 21h22

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