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

Struts 1 Java Discussion :

probleme pour passer un parametre entre 2 JSP


Sujet :

Struts 1 Java

  1. #1
    Membre à l'essai
    Inscrit en
    Mai 2007
    Messages
    20
    Détails du profil
    Informations forums :
    Inscription : Mai 2007
    Messages : 20
    Points : 12
    Points
    12
    Par défaut probleme pour passer un parametre entre 2 JSP
    bonjour,

    J'ai un probleme et je demande votre aide.

    Voici ma 1 ere JSP :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
     
    <logic:empty name="suiviForm" property="sitesurvey">
     
      <table width="200" border="1" align="center">
        <tr>
          <td class="Style1"><div align="center"><html:link href="/GestionClientMeditel/form/siteSurvey.jsp"
    			paramName="client"
    			paramProperty="nom"
    			paramId="nom">Editer un site survey</html:link>
    			</td>
        </tr>
      </table>			
     
    </logic:empty>

    donc ce code donne la main a la page sitesurvey.jsp avec le parametre nom.

    ce nom, je veux l'affichier dans cette page ,et voici son 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
    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
     
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%
     
    String nom=(String)request.getAttribute("nom");
     
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Document sans titre</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
     
    <!--
    body {
    	background-image: url(/GestionClientMeditel/form/images/rouge.jpg);
    }
    .Style1 {
    	color: #FFFFFF;
    	font-weight: bold;
    }
    .Style3 {color: #FFFFFF; font-weight: bold; font-size: 18px; }
    .Style5 {color: #FFFFFF}
    .Style6 {font-size: 14px}
    .Style7 {color: #FFFFFF; font-size: 14px; }
    -->
    </style></head>
     
    <body>
    <form action="/GestionClientMeditel/sitesurveyAdd.do" method="GET">
      <p><img src="/GestionClientMeditel/form/images/logo_meditel.jpg" width="152" height="77"></p>
      <table width="200" border="1" align="center">
        <tr>
          <td><div align="center"><span class="Style3">SITE SURVEY </span></div></td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <table width="446" border="1" align="center">
        <tr>
          <td><span class="Style1">NOM DU SITE </span></td>
         <td><input type="text" name="nom"><%=nom%></td>
        </tr>
        <tr>
          <td width="205"><span class="Style1">SUPERVISOR NAME </span></td>
          <td width="225"><input type="text" name="supervisornom"></td>
        </tr>
        <tr>
          <td class="Style1">SUPERVISOR PHONE </td>
          <td><input type="text" name="supervisornum"></td>
        </tr>
        <tr>
          <td class="Style1">DATE</td>
          <td><input type="text" name="datesurvey"></td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <table width="401" border="1" align="center">
        <tr>
          <td width="144"><div align="center" class="Style1">FAR END </div></td>
          <td width="150"><div align="center" class="Style1">AZIMUT</div></td>
          <td width="85"><div align="center" class="Style1">VISIBILITE</div></td>
        </tr>
        <tr>
          <td><input type="text" name="farend1"></td>
          <td><input name="azimut1" type="text" value="0"></td>
          <td><select name="los1" size="1">
            <option>LOS</option>
            <option>NLOS</option>
            <option>OLOS</option>
          </select></td>
        </tr>
        <tr>
          <td><input type="text" name="farend2"></td>
          <td><input name="azimut2" type="text" value="0"></td>
          <td><select name="los2" size="1">
            <option>LOS</option>
            <option>NLOS</option>
            <option>OLOS</option>
          </select></td>
        </tr>
        <tr>
          <td><input type="text" name="farend3"></td>
          <td><input name="azimut3" type="text" value="0"></td>
          <td><select name="los3" size="1">
            <option>LOS</option>
            <option>NLOS</option>
            <option>OLOS</option>
          </select></td>
        </tr>
        <tr>
          <td><input type="text" name="farend4"></td>
          <td><input name="azimut4" type="text" value="0"></td>
          <td><select name="los4" size="1">
            <option>LOS</option>
            <option>NLOS</option>
            <option>OLOS</option>
          </select></td>
        </tr>
      </table>
      <p>&nbsp;  </p>
      <table width="770" border="1" align="left">
        <tr>
          <td width="280" height="27" class="Style1">PREREQUIS</td>
          <td width="53">OUI</td>
          <td width="45">NON</td>
          <td width="213">&nbsp;</td>
          <td width="145">&nbsp;</td>
        </tr>
        <tr>
          <td class="Style5 Style6">Disponibilit&eacute; d'un pylone </td>
          <td><input type="radio" name="pylone" value="oui"></td>
          <td><input name="pylone" type="radio" value="non" checked></td>
          <td class="Style5 Style6">Hauteur NEAR END requise (en m) </td>
          <td><input name="hauteurnearend" type="text" value="0"></td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'un MAT </td>
          <td><input type="radio" name="mat" value="oui"></td>
          <td><input name="mat" type="radio" value="non" checked></td>
          <td class="Style7">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'un chemin de cable </td>
          <td><input type="radio" name="cable" value="oui"></td>
          <td><input name="cable" type="radio" value="non" checked></td>
          <td class="Style7">Longeur du chemin de cable (en m)</td>
          <td><input name="longueurcable" type="text" value="0"></td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; de la gaine </td>
          <td><input type="radio" name="gaine" value="oui"></td>
          <td><input name="gaine" type="radio" value="non" checked></td>
          <td class="Style7">Longeur de la gaine (en m) </td>
          <td><input name="longueurgaine" type="text" value="0"></td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'une mise a la terre Outdoor </td>
          <td><input type="radio" name="terreout" value="oui"></td>
          <td><input name="terreout" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'une mise a la terre Indoor </td>
          <td><input type="radio" name="terrein" value="oui"></td>
          <td><input name="terrein" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'un local pour l'installation Indoor </td>
          <td><input type="radio" name="localin" value="oui"></td>
          <td><input name="localin" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; de l'energie -48V </td>
          <td><input type="radio" name="energie" value="oui"></td>
          <td><input name="energie" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'un depart 220V </td>
          <td><input type="radio" name="depart220V" value="oui"></td>
          <td><input name="depart220V" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilite d'une Echelle </td>
          <td><input type="radio" name="echelle" value="oui"></td>
          <td><input name="echelle" type="radio" value="non" checked></td>
          <td><span class="Style5">Hauteur de l'Echelle</span></td>
          <td><input name="hauteurechelle" type="text" value="0"></td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'un RACK </td>
          <td><input type="radio" name="rack" value="oui"></td>
          <td><input name="rack" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table>
      <p><br>
        <label>  </label>
        <br>
      </p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <table width="75" border="1" align="center">
        <tr>
          <td width="65"><input type="submit" name="Submit" value="VALIDER"></td>
        </tr>
      </table>
      <p>&nbsp;</p>
    </form>
    </body>
    </html>
    La partie qui nous interesse de ce code est :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    <tr>
          <td><span class="Style1">NOM DU SITE </span></td>
         <td><input type="text" name="nom"><%=nom%></td>
        </tr>
    J'ai essayer de recuperer le nom par la methode getAttribute mais ca marche pas.

    comment faire? et merci

  2. #2
    Membre à l'essai
    Profil pro
    Étudiant
    Inscrit en
    Décembre 2006
    Messages
    11
    Détails du profil
    Informations personnelles :
    Âge : 38
    Localisation : France, Nord (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Décembre 2006
    Messages : 11
    Points : 11
    Points
    11
    Par défaut
    Au lieu d'un getAttribute(), as tu testé
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    request.getParameter("nom")

  3. #3
    Membre chevronné Avatar de Mister Nono
    Homme Profil pro
    Ingénieur Mathématiques et Informatique
    Inscrit en
    Septembre 2002
    Messages
    2 232
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur Mathématiques et Informatique
    Secteur : Santé

    Informations forums :
    Inscription : Septembre 2002
    Messages : 2 232
    Points : 1 897
    Points
    1 897
    Par défaut
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <bean:write name="TonFormulaire" property="nom" /> // TonFormulaire : nom du formulaire comme nommé dans le fichier de configuration struts
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
    Avec les el de JSTL :
    ${TonFormulaire.nom}
    A+

  4. #4
    Expert éminent

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Points : 7 778
    Points
    7 778
    Par défaut
    Pourquoi ouvrir une nouvelle discussion à ce sujet ?
    J'avais déjà donné une réponse dans cette discussion mais tu n'y as jamais donné suite.

  5. #5
    Membre chevronné Avatar de Mister Nono
    Homme Profil pro
    Ingénieur Mathématiques et Informatique
    Inscrit en
    Septembre 2002
    Messages
    2 232
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur Mathématiques et Informatique
    Secteur : Santé

    Informations forums :
    Inscription : Septembre 2002
    Messages : 2 232
    Points : 1 897
    Points
    1 897
    Par défaut
    Citation Envoyé par c_nvy
    Pourquoi ouvrir une nouvelle discussion à ce sujet ?
    J'avais déjà donné une réponse dans cette discussion mais tu n'y as jamais donné suite.
    Alors là, ce n'est pas bien du tout du tout.

  6. #6
    Membre à l'essai
    Inscrit en
    Mai 2007
    Messages
    20
    Détails du profil
    Informations forums :
    Inscription : Mai 2007
    Messages : 20
    Points : 12
    Points
    12
    Par défaut
    bonjour,

    Je suis désole si j'ai repose la meme question, ce que je voulais c'est de precsier plus mon probleme...

    L'important, j'ai essayer avec getParameter et ca marche, sauf que le nom que je veux afficher ne s'affiche pas dans la zone de texte designée mais juste a cote de ceci .

    Voici mon 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
    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
     
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%
     
    String nom=(String)request.getParameter("nom");
     
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Document sans titre</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
     
    <!--
    body {
    	background-image: url(/GestionClientMeditel/form/images/rouge.jpg);
    }
    .Style1 {
    	color: #FFFFFF;
    	font-weight: bold;
    }
    .Style3 {color: #FFFFFF; font-weight: bold; font-size: 18px; }
    .Style5 {color: #FFFFFF}
    .Style6 {font-size: 14px}
    .Style7 {color: #FFFFFF; font-size: 14px; }
    -->
    </style></head>
     
    <body>
    <form action="/GestionClientMeditel/sitesurveyAdd.do" method="GET">
      <p><img src="/GestionClientMeditel/form/images/logo_meditel.jpg" width="152" height="77"></p>
      <table width="200" border="1" align="center">
        <tr>
          <td><div align="center"><span class="Style3">SITE SURVEY </span></div></td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <table width="446" border="1" align="center">
        <tr>
          <td><span class="Style1">NOM DU SITE </span></td>
         <td><input type="text" name="nom"><%=nom%></td>
        </tr>
        <tr>
          <td width="205"><span class="Style1">SUPERVISOR NAME </span></td>
          <td width="225"><input type="text" name="supervisornom"></td>
        </tr>
        <tr>
          <td class="Style1">SUPERVISOR PHONE </td>
          <td><input type="text" name="supervisornum"></td>
        </tr>
        <tr>
          <td class="Style1">DATE</td>
          <td><input type="text" name="datesurvey"></td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <table width="401" border="1" align="center">
        <tr>
          <td width="144"><div align="center" class="Style1">FAR END </div></td>
          <td width="150"><div align="center" class="Style1">AZIMUT</div></td>
          <td width="85"><div align="center" class="Style1">VISIBILITE</div></td>
        </tr>
        <tr>
          <td><input type="text" name="farend1"></td>
          <td><input name="azimut1" type="text" value="0"></td>
          <td><select name="los1" size="1">
            <option>LOS</option>
            <option>NLOS</option>
            <option>OLOS</option>
          </select></td>
        </tr>
        <tr>
          <td><input type="text" name="farend2"></td>
          <td><input name="azimut2" type="text" value="0"></td>
          <td><select name="los2" size="1">
            <option>LOS</option>
            <option>NLOS</option>
            <option>OLOS</option>
          </select></td>
        </tr>
        <tr>
          <td><input type="text" name="farend3"></td>
          <td><input name="azimut3" type="text" value="0"></td>
          <td><select name="los3" size="1">
            <option>LOS</option>
            <option>NLOS</option>
            <option>OLOS</option>
          </select></td>
        </tr>
        <tr>
          <td><input type="text" name="farend4"></td>
          <td><input name="azimut4" type="text" value="0"></td>
          <td><select name="los4" size="1">
            <option>LOS</option>
            <option>NLOS</option>
            <option>OLOS</option>
          </select></td>
        </tr>
      </table>
      <p>&nbsp;  </p>
      <table width="770" border="1" align="left">
        <tr>
          <td width="280" height="27" class="Style1">PREREQUIS</td>
          <td width="53">OUI</td>
          <td width="45">NON</td>
          <td width="213">&nbsp;</td>
          <td width="145">&nbsp;</td>
        </tr>
        <tr>
          <td class="Style5 Style6">Disponibilit&eacute; d'un pylone </td>
          <td><input type="radio" name="pylone" value="oui"></td>
          <td><input name="pylone" type="radio" value="non" checked></td>
          <td class="Style5 Style6">Hauteur NEAR END requise (en m) </td>
          <td><input name="hauteurnearend" type="text" value="0"></td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'un MAT </td>
          <td><input type="radio" name="mat" value="oui"></td>
          <td><input name="mat" type="radio" value="non" checked></td>
          <td class="Style7">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'un chemin de cable </td>
          <td><input type="radio" name="cable" value="oui"></td>
          <td><input name="cable" type="radio" value="non" checked></td>
          <td class="Style7">Longeur du chemin de cable (en m)</td>
          <td><input name="longueurcable" type="text" value="0"></td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; de la gaine </td>
          <td><input type="radio" name="gaine" value="oui"></td>
          <td><input name="gaine" type="radio" value="non" checked></td>
          <td class="Style7">Longeur de la gaine (en m) </td>
          <td><input name="longueurgaine" type="text" value="0"></td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'une mise a la terre Outdoor </td>
          <td><input type="radio" name="terreout" value="oui"></td>
          <td><input name="terreout" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'une mise a la terre Indoor </td>
          <td><input type="radio" name="terrein" value="oui"></td>
          <td><input name="terrein" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'un local pour l'installation Indoor </td>
          <td><input type="radio" name="localin" value="oui"></td>
          <td><input name="localin" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; de l'energie 48V </td>
          <td><input type="radio" name="energie" value="oui"></td>
          <td><input name="energie" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'un depart 220V </td>
          <td><input type="radio" name="depart220V" value="oui"></td>
          <td><input name="depart220V" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilite d'une Echelle </td>
          <td><input type="radio" name="echelle" value="oui"></td>
          <td><input name="echelle" type="radio" value="non" checked></td>
          <td><span class="Style5">Hauteur de l'Echelle</span></td>
          <td><input name="hauteurechelle" type="text" value="0"></td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'un RACK </td>
          <td><input type="radio" name="rack" value="oui"></td>
          <td><input name="rack" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table>
      <p><br>
        <label>  </label>
        <br>
      </p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <table width="75" border="1" align="center">
        <tr>
          <td width="65"><input type="submit" name="Submit" value="VALIDER"></td>
        </tr>
      </table>
      <p>&nbsp;</p>
    </form>
    </body>
    </html>
    Je veux que le input text "nom" soit rempli par cette valeur.comment faire SVP?

    merci d'avance

  7. #7
    Expert éminent

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Points : 7 778
    Points
    7 778
    Par défaut
    Au clic sur le html:link, il serait plus propre d'exécuter une Action (comme je te l'ai déjà proposé dans une précédente discussion ) :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    <html:link action="initSiteSurvey" paramName="client" paramProperty="nom" paramId="nom">
       Editer un site survey
    </html:link>
    Tu crées une Action InitSiteSurvey qui récupère le nom passé en paramètre et qui initialise le formulaire de la deuxième page jsp :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    String nom=request.getParameter("nom") ;
    TonActionForm tonActionForm=(TonActionForm) form ;
    tonActionForm.setNom(nom);
    return mapping.findForward("success") ;
    Tu définis le mapping de cette Action dans le struts-config.xml comme ceci :
    Code xml : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <action path="/initSiteSurvey" type="nomDeTonPackage.InitSiteSurvey"
            name="nomDuFormBean" scope="session" validate="false">
       <forward name="success" path="/form/siteSurvey.jsp"/>
    </action>
    où nomDuFormBean est égale au nom du form-bean de l'Action de path /siteSurveyAdd.

    Et dans la jsp :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    <html:form action="sitesurveyAdd">
       <html:text property="nom"/>
       ...
    </html:form>

  8. #8
    Membre chevronné Avatar de Mister Nono
    Homme Profil pro
    Ingénieur Mathématiques et Informatique
    Inscrit en
    Septembre 2002
    Messages
    2 232
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 60
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Ingénieur Mathématiques et Informatique
    Secteur : Santé

    Informations forums :
    Inscription : Septembre 2002
    Messages : 2 232
    Points : 1 897
    Points
    1 897
    Par défaut
    Elle est gentille c_nvy.

    Elle t'a tout expliqué en détail.

  9. #9
    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
    Points : 9 529
    Points
    9 529
    Billets dans le blog
    1
    Par défaut
    Enfin là, c'est un peu bête, tu y étais presque...
    Il suffisait de faire
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    <input type="text" name="nom" value="<%=nom%>" />
    A+

  10. #10
    Expert éminent

    Femme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    5 793
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France

    Informations forums :
    Inscription : Juillet 2005
    Messages : 5 793
    Points : 7 778
    Points
    7 778
    Par défaut
    Peut-être mais moi je trouve dommage de coder des scriptlets dans les jsp quand on utilise Struts.

    Enfin, chacun fait comme il veut.

  11. #11
    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
    Points : 9 529
    Points
    9 529
    Billets dans le blog
    1
    Par défaut
    Citation Envoyé par c_nvy
    Peut-être mais moi je trouve dommage de coder des scriptlets dans les jsp quand on utilise Struts.

    Enfin, chacun fait comme il veut.
    Tout à fait d'accord avec toi, mais bon, il fera comme il veut...

  12. #12
    Membre à l'essai
    Inscrit en
    Mai 2007
    Messages
    20
    Détails du profil
    Informations forums :
    Inscription : Mai 2007
    Messages : 20
    Points : 12
    Points
    12
    Par défaut
    bonjour,

    j'ai essayer comme t'as dis, et c'est logique car j'ai fait de meme pour modifier les valeurs d'autres pages...mais ici ca marche pas !

    voici ce que j'ai fait :



    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
    <action path="/passeSurvey" 
        attribute="sitesurveyForm"
        type="com.gestionclientmeditel.struts.action.PasseSurveyAction"
        name="sitesurveyForm" 
        scope="session" 
        validate="false">
       <forward name="success" path="/form/siteSurvey.jsp"/>
    </action>
    l'action associee :
    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
     
    /*
     * Created on 19 juin 2007
     *
     * TODO To change the template for this generated file go to
     * Window - Preferences - Java - Code Style - Code Templates
     */
    package com.gestionclientmeditel.struts.action;
     
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
     
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
     
     
    import com.gestionclientmeditel.struts.form.SiteSurveyForm;
     
    /**
     * @author ysf
     *
     * TODO To change the template for this generated type comment go to
     * Window - Preferences - Java - Code Style - Code Templates
     */
    public class PasseSurveyAction extends Action{
     
    	public ActionForward execute(
    			ActionMapping mapping,
    			ActionForm form,
    			HttpServletRequest request,
    			HttpServletResponse response) {
     
    		String nom=request.getParameter("nom") ;
    		System.out.println("ca passe "+nom);
    			SiteSurveyForm b = (SiteSurveyForm) form;
     
     
     
     
    		    b.setNom(nom);
    			return mapping.findForward("success") ;
     
    	}
     
    }
    dans la 1 ere page :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
    <table width="200" border="1" align="center">
        <tr>
          <td class="Style1"><div align="center"><html:link action="passeSurvey.do"
    			paramName="client"
    			paramProperty="nom"
    			paramId="nom">Editer un site survey</html:link>
    			</td>
        </tr>
      </table>
    la 2 eme 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
    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
     
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%@ page language="java"%>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
    <%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Document sans titre</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
     
    <!--
    body {
    	background-image: url(/GestionClientMeditel/form/images/rouge.jpg);
    }
    .Style1 {
    	color: #FFFFFF;
    	font-weight: bold;
    }
    .Style3 {color: #FFFFFF; font-weight: bold; font-size: 18px; }
    .Style5 {color: #FFFFFF}
    .Style6 {font-size: 14px}
    .Style7 {color: #FFFFFF; font-size: 14px; }
    -->
    </style></head>
     
    <body>
    <html:form action="sitesurveyAdd.do">
     
      <p><img src="/GestionClientMeditel/form/images/logo_meditel.jpg" width="152" height="77"></p>
      <table width="200" border="1" align="center">
        <tr>
          <td><div align="center"><span class="Style3">SITE SURVEY </span></div></td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <table width="446" border="1" align="center">
        <tr>
          <td><span class="Style1">NOM DU SITE </span></td>
         <td><html:text property="nom"/></td>
        </tr>
        <tr>
          <td width="205"><span class="Style1">SUPERVISOR NAME</span></td>
          <td width="225"><input type="text" name="supervisornom"></td>
        </tr>
        <tr>
          <td class="Style1">SUPERVISOR PHONE </td>
          <td><input type="text" name="supervisornum"></td>
        </tr>
        <tr>
          <td class="Style1">DATE</td>
          <td><input type="text" name="datesurvey"></td>
        </tr>
      </table>
      <p>&nbsp;</p>
      <table width="401" border="1" align="center">
        <tr>
          <td width="144"><div align="center" class="Style1">FAR END </div></td>
          <td width="150"><div align="center" class="Style1">AZIMUT</div></td>
          <td width="85"><div align="center" class="Style1">VISIBILITE</div></td>
        </tr>
        <tr>
          <td><input type="text" name="farend1"></td>
          <td><input name="azimut1" type="text" value="0"></td>
          <td><select name="los1" size="1">
            <option>LOS</option>
            <option>NLOS</option>
            <option>OLOS</option>
          </select></td>
        </tr>
        <tr>
          <td><input type="text" name="farend2"></td>
          <td><input name="azimut2" type="text" value="0"></td>
          <td><select name="los2" size="1">
            <option>LOS</option>
            <option>NLOS</option>
            <option>OLOS</option>
          </select></td>
        </tr>
        <tr>
          <td><input type="text" name="farend3"></td>
          <td><input name="azimut3" type="text" value="0"></td>
          <td><select name="los3" size="1">
            <option>LOS</option>
            <option>NLOS</option>
            <option>OLOS</option>
          </select></td>
        </tr>
        <tr>
          <td><input type="text" name="farend4"></td>
          <td><input name="azimut4" type="text" value="0"></td>
          <td><select name="los4" size="1">
            <option>LOS</option>
            <option>NLOS</option>
            <option>OLOS</option>
          </select></td>
        </tr>
      </table>
      <p>&nbsp;  </p>
      <table width="770" border="1" align="left">
        <tr>
          <td width="280" height="27" class="Style1">PREREQUIS</td>
          <td width="53">OUI</td>
          <td width="45">NON</td>
          <td width="213">&nbsp;</td>
          <td width="145">&nbsp;</td>
        </tr>
        <tr>
          <td class="Style5 Style6">Disponibilit&eacute; d'un pylone </td>
          <td><input type="radio" name="pylone" value="oui"></td>
          <td><input name="pylone" type="radio" value="non" checked></td>
          <td class="Style5 Style6">Hauteur NEAR END requise (en m) </td>
          <td><input name="hauteurnearend" type="text" value="0"></td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'un MAT </td>
          <td><input type="radio" name="mat" value="oui"></td>
          <td><input name="mat" type="radio" value="non" checked></td>
          <td class="Style7">&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'un chemin de cable </td>
          <td><input type="radio" name="cable" value="oui"></td>
          <td><input name="cable" type="radio" value="non" checked></td>
          <td class="Style7">Longeur du chemin de cable (en m)</td>
          <td><input name="longueurcable" type="text" value="0"></td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; de la gaine </td>
          <td><input type="radio" name="gaine" value="oui"></td>
          <td><input name="gaine" type="radio" value="non" checked></td>
          <td class="Style7">Longeur de la gaine (en m) </td>
          <td><input name="longueurgaine" type="text" value="0"></td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'une mise a la terre Outdoor </td>
          <td><input type="radio" name="terreout" value="oui"></td>
          <td><input name="terreout" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'une mise a la terre Indoor </td>
          <td><input type="radio" name="terrein" value="oui"></td>
          <td><input name="terrein" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'un local pour l'installation Indoor </td>
          <td><input type="radio" name="localin" value="oui"></td>
          <td><input name="localin" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; de l'energie 48V </td>
          <td><input type="radio" name="energie" value="oui"></td>
          <td><input name="energie" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'un depart 220V </td>
          <td><input type="radio" name="depart220V" value="oui"></td>
          <td><input name="depart220V" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td class="Style7">Disponibilite d'une Echelle </td>
          <td><input type="radio" name="echelle" value="oui"></td>
          <td><input name="echelle" type="radio" value="non" checked></td>
          <td><span class="Style5">Hauteur de l'Echelle</span></td>
          <td><input name="hauteurechelle" type="text" value="0"></td>
        </tr>
        <tr>
          <td class="Style7">Disponibilit&eacute; d'un RACK </td>
          <td><input type="radio" name="rack" value="oui"></td>
          <td><input name="rack" type="radio" value="non" checked></td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
      </table>
      <p><br>
        <label>  </label>
        <br>
      </p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <table width="75" border="1" align="center">
        <tr>
          <td width="65"><input type="submit" name="Submit" value="VALIDER"></td>
        </tr>
      </table>
      <p>&nbsp;</p>
    </html:form>
    </body>
    </html>
    Donc ce qui m'interesse dans cette page c'est :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
     
    <tr>
          <td><span class="Style1">NOM DU SITE </span></td>
         <td><html:text property="nom"/></td>
        </tr>
        <tr>
    et l'action de la 2 eme page :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
    <action
          attribute="sitesurveyForm"
          input="/form/siteSurvey.jsp"
          name="sitesurveyForm"
          path="/sitesurveyAdd"
          scope="request"
          type="com.gestionclientmeditel.struts.action.SiteSurveyAddAction">
          <forward name="index2" path="/viewClients.do?do=showClients" />
    </action>
    SVP trouver le probleme car j'ai besoin de cette solution ces jours.

    merci

  13. #13
    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
    Points : 9 529
    Points
    9 529
    Billets dans le blog
    1
    Par défaut
    Dans la première définition d'action, tu utilises un scope session et dans la deuxième un scope request !
    Il faudrait mettre le même aux 2

  14. #14
    Membre à l'essai
    Inscrit en
    Mai 2007
    Messages
    20
    Détails du profil
    Informations forums :
    Inscription : Mai 2007
    Messages : 20
    Points : 12
    Points
    12
    Par défaut
    salut,

    Le probleme est regle et voici le résume:

    pour mon cas, vous m'avez propose 2 solutions qui marchent :

    1-<input type="text" name="nom" value="<%=nom%>" /> et c'est simple et ne necessite pas d'ecrire d'autres lignes....
    2-Ecrire une action entre les 2 JSP , c'est organisé mais il faut tres bien comprendre ce kon tape.

    merci a vous tous, vous etes SALAMA!

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. passer un attribut entre deux jsp.
    Par don'de dans le forum Servlets/JSP
    Réponses: 3
    Dernier message: 19/12/2006, 09h37
  2. Passer des parametres d'une jsp à une servlet
    Par MAJIK_ENIS dans le forum Servlets/JSP
    Réponses: 1
    Dernier message: 30/10/2006, 23h39
  3. Probleme pour passer une Procedure
    Par Kahiba dans le forum Delphi
    Réponses: 10
    Dernier message: 04/10/2006, 10h37
  4. Probleme pour passer de l'écriture html a php
    Par cyberdevelopment dans le forum Langage
    Réponses: 2
    Dernier message: 18/08/2006, 17h24
  5. Réponses: 2
    Dernier message: 04/10/2005, 20h54

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