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 :

Un problème avec AjaxTags et Struts (plusieurs forms et plusieurs ajax:displayTag)


Sujet :

Struts 1 Java

  1. #1
    Membre à l'essai
    Inscrit en
    Mai 2007
    Messages
    34
    Détails du profil
    Informations forums :
    Inscription : Mai 2007
    Messages : 34
    Points : 24
    Points
    24
    Par défaut Un problème avec AjaxTags et Struts (plusieurs forms et plusieurs ajax:displayTag)
    Mon problème est le suivant :
    Je commence a utiliser Ajaxtags Dans mon projet Struts, et dans une vue je dois mettre trois Form( html:form), et dans chacune des forms j’ai mis une table avec la tag ajax:displayTag, mais la pagination et le tris ne fonctionne pas dans la deuxième et la troisième table, et le code et le suivant : (avec des petite modification )
    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
     
    <!------------------------------------------------------------------  les Clients ------------------------------------------------------------------------------------------>
    <html:form action="/Clients.do">
    			<ajax:displayTag id="displayTagFrame1" ajaxFlag="displayAjax1">
    			<display:table
    				name="Clients" class="displaytag" pagesize="10" defaultsort="1"
    				defaultorder="descending" id="row" excludedParams="ajax"
    				requestURI="Clients.do"
    				decorator="com.ClientsOP">
    				<display:column property="nom_Client" sortable="true"
    					headerClass="sortable" title="Non du Client"></display:column>
     
    			</display:table>
    			</ajax:displayTag>
    			 <br />
    			<table width="330" border="1" cellpadding="0" cellspacing="0"
    				class="table1">
    				<tr align="center" valign="middle">
    					<td width="169" align="left" valign="middle" bgcolor="#999999"
    						class="case3" scope="row"><strong>Nom du Client </strong></td>
    					<td width="190" align="left" valign="middle" scope="row"><input
    						name="nom_Client" type="text" value="" class="text" />
    						</td>
    				</tr>
    			</table>
    			<table width="330" border="0" cellpadding="0" cellspacing="0">
    				<tr>
    					<td width="165" align="left" scope="row"><input type="button"
    						name="ajouterClient" value="Nouveau" onclick="reset()" size="15" />
     
    						<input type="button" name="imprimer" value="Imprimer"
    							onclick="window.open('../Rapport/run?__report=report/Client.rptdesign&amp;__format=pdf','nom_popup')" />
    					</td>
    					<td width="165" align="right" valign="middle"><html:button
    						property="validerCl" value="Valider" onclick="testForm1()">
    					</html:button> <input name="AnnulerCL" type="button" id="AnnulerCL" onclick=""
    						value="Annuler" /></td>
    				</tr>
    			</table>
     
     
    		</html:form>
     
    		<!----------------------------Les Voitures ------------------------------------------->
    		<html:form action="/gestVoiture.do">
     
    			<ajax:displayTag id="displayTagFrame2" ajaxFlag="displayAjax2">
    				<display:table name="Voitures" class="displaytag" pagesize="10"
    					defaultsort="1" defaultorder="descending"
    					requestURI="gestNavArm.do" excludedParams="ajax"
    					decorator="com.VoituresOP">
     
    					<display:column property="code_Voitures" title="Code Voitures"
    						sortable="true"></display:column>
    					<display:column property="type_Voitures" title="Type Voitures"
    						sortable="true"></display:column>
    					<display:column property="prixTTC"
    						title="Prix TTC" sortable="true"></display:column>
     
    				</display:table>
    			</ajax:displayTag>
     
    			<br />
    			<table width="330" border="1" cellpadding="0" cellspacing="0"
    				class="table1">
    				<tr align="center" valign="middle">
    					<td width="169" align="left" valign="middle" bgcolor="#999999"
    						class="case1" scope="row"><strong>Code Voitures</strong></td>
    					<td width="157" align="left" valign="middle" class="case2"
    						scope="row"><input name="codeVoitures" type="text" value=""
    						class="text" /></td>
    				</tr>
    				<tr align="center" valign="middle">
    					<td align="left" valign="middle" bgcolor="#999999" class="case1"
    						scope="row"><strong>Type Voitures</strong></td>
    					<td align="left" valign="middle" scope="row" class="case2"><input
    						name="typeVoitures" type="text" value="" class="text" /></td>
    				</tr>
    				<tr align="center" valign="middle">
    					<td align="left" valign="middle" bgcolor="#999999" class="case3"
    						scope="row"><strong>Prix HTT</strong></td>
    					<td align="left" valign="middle" scope="row"><input
    						name="PrixHTT" type="text" value="" class="text" /></td>
    				</tr>
    			</table>
    			<table width="330" border="0" cellpadding="0" cellspacing="0">
    				<tr>
    					<th width="165" align="left" scope="row"><input type="button"
    						name="NewVoiture" value="Nouveau" onclick="reset1()" /> 
    						<input type="button" name="ImprimerVo" value="Imprimer"
    							onclick="window.open('../Rapport/run?__report=report/Voitures.rptdesign&amp;__format=pdf','nom_popup')" />
    					</th>
    					<td width="165" align="right" valign="middle"><html:button
    						property="validerVO" value="Valider" onclick="testForm2();">
    					</html:button> <input name="AnnulerVO" type="button" id="AnnulerAr" onclick=""
    						value="Annuler" /></td>
    				</tr>
    			</table>
     
    		</html:form>
    <!--------------------------------------------- la location  -------------------------------->		
     
    	<html:form action="/Location.do">
    				<ajax:displayTag id="displayTagFrame3" ajaxFlag="displayAjax3">
    				<display:table name="Location" class="displaytag" pagesize="10"
    					defaultsort="1" defaultorder="descending"
    					requestURI="Location.do" excludedParams="ajax"
    					decorator="com.LocationOP">
    					<display:column property="code_Voiture" title="Code Voiture"></display:column>
    					<display:column property="nom_Client" title="Nom Client"></display:column>
    					<display:column property="date_aff" title="Date	début"></display:column>
    					<display:column property="date_desaff" title="Date fin"></display:column>
     
    				></display:column>
    					</display:table>
    			</ajax:displayTag>
    			<br />
    			<table width="329" border="0" cellpadding="0" cellspacing="0"
    				class="table1">
    				<tr>
    					<td align="left" bgcolor="#999999" class="case1" scope="row"><span
    						class="Style7">Voiture</span></td>
    					<td><select name="Voiture" style="width: 146px"
    						onchange="setCodeVO()" class="text">
    						<option></option>
    						<logic:iterate id="choix" name="voitures"
    							type="com.metier.Voiture" scope="session">
    							<option id="Voiture" value="<%= choix.getCode_Voiture() %>">
    							<%=choix.getNom_Voiture()%></option>
    						</logic:iterate>
    					</select></td>
    				</tr>
    				<tr>
    					<td align="left" bgcolor="#999999" class="case1" scope="row"><span
    						class="Style7">Code Voiture</span></td>
    					<td><html:text property="VoitureCode" name="VoitureCode"
    						value="" readonly="true" styleClass="text" style="width: 140px"></html:text></td>
     
    				</tr>
    				<tr>
    					<td align="left" bgcolor="#999999" class="case1" scope="row">Client</td>
    					<td><select name="ClientName" style="width: 146px"
    						class="text">
    						<option></option>
    						<logic:iterate id="choix" name="clients"
    							type="com.metier.Client" scope="session">
    							<option id="Client" value="<%= choix.getNom_Client() %>"><bean:write
    								name="choix" property="nom_Client" /></option>
    						</logic:iterate>
    					</select></td>
    				</tr>
    				<tr>
    					<td align="left" bgcolor="#999999" class="case1" scope="row">Date
    					début</td>
    					<td><input type="text" name="dateAffectationN" value=""
    						readonly="readonly" class="text" style="width: 140px" /> <html:img
    						src="Images/clr.PNG" title="Choisir la date début"
    						onclick="if(self.gfPop)gfPop.fPopCalendar(document.forms[2].elements['dateAffectationN']);return false;"
    						style="border-width:0;"></html:img></td>
    				</tr>
    				<tr>
    					<td align="left" bgcolor="#999999" class="case3" scope="row">Date
    					fin</td>
    					<td><input type="text" name="datedesaffN" value=""
    						readonly="readonly" class="text" style="width: 140px" /> <html:img
    						src="Images/clr.PNG" title="Choisir la date fin"
    						onclick="if(self.gfPop)gfPop.fPopCalendar(document.forms[2].elements['datedesaffN']);return false;"
    						style="border-width:0;"></html:img></td>
    				</tr>
    			</table>
     
    			<table width="387" border="0" align="left" cellpadding="0"
    				cellspacing="0">
    				<tr>
    					<th width="1" scope="row"><html:button property="nouvAFF"
    						value="Nouveau..." onclick="reset3()" /></th>
    					<td width="16">&nbsp;</td>
    					<td width="1"><html:button property="validaff" value="Valider"
    						onclick="testDat()" /></td>
    					<td><input type="button" name="effAff" value="effacer" /></td>
    				</tr>
    			</table>
     
     
    	</html:form>
    Alors j’ai changé de stratégie, au lieu d’utilisé seulement ajax:displayTag, j’ai utilisé un combinaison entre ajax:anchors et ajax:area, de la façon suivante :
    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
     
    <!------------------------------------------------------------------  les Clients ------------------------------------------------------------------------------------------>
    <html:form action="/Clients.do">
    			<ajax:area id="ajaxFrame1"
    				style="width:300px; min-height:100px; height:100px;"
    				styleClass="textArea" ajaxAnchors="true" ajaxFlag="ajaxFrame1">
    			<display:table
    				name="Clients" class="displaytag" pagesize="10" defaultsort="1"
    				defaultorder="descending" id="row" excludedParams="ajax"
    				requestURI="Clients.do"
    				decorator="com.ClientsOP">
    				<display:column property="nom_Client" sortable="true"
    					headerClass="sortable" title="Non du Client"></display:column>
     
    			</display:table>
    			</ajax:area>
    			 <br />
    			<table width="330" border="1" cellpadding="0" cellspacing="0"
    				class="table1">
    				<tr align="center" valign="middle">
    					<td width="169" align="left" valign="middle" bgcolor="#999999"
    						class="case3" scope="row"><strong>Nom du Client </strong></td>
    					<td width="190" align="left" valign="middle" scope="row"><input
    						name="nom_Client" type="text" value="" class="text" />
    						</td>
    				</tr>
    			</table>
    			<table width="330" border="0" cellpadding="0" cellspacing="0">
    				<tr>
    					<td width="165" align="left" scope="row"><input type="button"
    						name="ajouterClient" value="Nouveau" onclick="reset()" size="15" />
     
    						<input type="button" name="imprimer" value="Imprimer"
    							onclick="window.open('../Rapport/run?__report=report/Client.rptdesign&amp;__format=pdf','nom_popup')" />
    					</td>
    					<td width="165" align="right" valign="middle">
    					<ajax:anchors target="ajaxFrame1" ajaxFlag="ajaxFrame1">
    					<html:button
    						property="validerCl" value="Valider" onclick="testForm1()">
    					</html:button> 
    					</ajax:anchors>
    					<input name="AnnulerCL" type="button" id="AnnulerCL" onclick=""
    						value="Annuler" /></td>
    				</tr>
    			</table>
     
     
    		</html:form>
     
    		<!----------------------------Les Voitures ------------------------------------------->
    		<html:form action="/gestVoiture.do">
     
    			<ajax:area id="ajaxFrame2"
    				style="width:300px; min-height:100px; height:100px;"
    				styleClass="textArea" ajaxAnchors="true" ajaxFlag="ajaxFrame2">
    				<display:table name="Voitures" class="displaytag" pagesize="10"
    					defaultsort="1" defaultorder="descending"
    					requestURI="gestNavArm.do" excludedParams="ajax"
    					decorator="com.VoituresOP">
     
    					<display:column property="code_Voitures" title="Code Voitures"
    						sortable="true"></display:column>
    					<display:column property="type_Voitures" title="Type Voitures"
    						sortable="true"></display:column>
    					<display:column property="prixTTC"
    						title="Prix TTC" sortable="true"></display:column>
     
    				</display:table>
    			</ajax:area>
     
    			<br />
    			<table width="330" border="1" cellpadding="0" cellspacing="0"
    				class="table1">
    				<tr align="center" valign="middle">
    					<td width="169" align="left" valign="middle" bgcolor="#999999"
    						class="case1" scope="row"><strong>Code Voitures</strong></td>
    					<td width="157" align="left" valign="middle" class="case2"
    						scope="row"><input name="codeVoitures" type="text" value=""
    						class="text" /></td>
    				</tr>
    				<tr align="center" valign="middle">
    					<td align="left" valign="middle" bgcolor="#999999" class="case1"
    						scope="row"><strong>Type Voitures</strong></td>
    					<td align="left" valign="middle" scope="row" class="case2"><input
    						name="typeVoitures" type="text" value="" class="text" /></td>
    				</tr>
    				<tr align="center" valign="middle">
    					<td align="left" valign="middle" bgcolor="#999999" class="case3"
    						scope="row"><strong>Prix HTT</strong></td>
    					<td align="left" valign="middle" scope="row"><input
    						name="PrixHTT" type="text" value="" class="text" /></td>
    				</tr>
    			</table>
    			<table width="330" border="0" cellpadding="0" cellspacing="0">
    				<tr>
    					<th width="165" align="left" scope="row"><input type="button"
    						name="NewVoiture" value="Nouveau" onclick="reset1()" /> 
    						<input type="button" name="ImprimerVo" value="Imprimer"
    							onclick="window.open('../Rapport/run?__report=report/Voitures.rptdesign&amp;__format=pdf','nom_popup')" />
    					</th>
    					<td width="165" align="right" valign="middle">
    					<ajax:anchors target="ajaxFrame2" ajaxFlag="ajaxFrame2">
    					<html:button
    						property="validerVO" value="Valider" onclick="testForm2();">
    					</html:button> 
    					</ajax:anchors>
    					<input name="AnnulerVO" type="button" id="AnnulerAr" onclick=""
    						value="Annuler" /></td>
    				</tr>
    			</table>
     
    		</html:form>
    <!--------------------------------------------- la location  -------------------------------->		
     
    	<html:form action="/Location.do">
    				<ajax:area id="ajaxFrame3"
    				style="width:300px; min-height:100px; height:100px;"
    				styleClass="textArea" ajaxAnchors="true" ajaxFlag="ajaxFrame3">
    				<display:table name="Location" class="displaytag" pagesize="10"
    					defaultsort="1" defaultorder="descending"
    					requestURI="Location.do" excludedParams="ajax"
    					decorator="com.LocationOP">
    					<display:column property="code_Voiture" title="Code Voiture"></display:column>
    					<display:column property="nom_Client" title="Nom Client"></display:column>
    					<display:column property="date_aff" title="Date	début"></display:column>
    					<display:column property="date_desaff" title="Date fin"></display:column>
     
    				></display:column>
    					</display:table>
    			</ajax:area>
    			<br />
    			<table width="329" border="0" cellpadding="0" cellspacing="0"
    				class="table1">
    				<tr>
    					<td align="left" bgcolor="#999999" class="case1" scope="row"><span
    						class="Style7">Voiture</span></td>
    					<td><select name="Voiture" style="width: 146px"
    						onchange="setCodeVO()" class="text">
    						<option></option>
    						<logic:iterate id="choix" name="voitures"
    							type="com.metier.Voiture" scope="session">
    							<option id="Voiture" value="<%= choix.getCode_Voiture() %>">
    							<%=choix.getNom_Voiture()%></option>
    						</logic:iterate>
    					</select></td>
    				</tr>
    				<tr>
    					<td align="left" bgcolor="#999999" class="case1" scope="row"><span
    						class="Style7">Code Voiture</span></td>
    					<td><html:text property="VoitureCode" name="VoitureCode"
    						value="" readonly="true" styleClass="text" style="width: 140px"></html:text></td>
     
    				</tr>
    				<tr>
    					<td align="left" bgcolor="#999999" class="case1" scope="row">Client</td>
    					<td><select name="ClientName" style="width: 146px"
    						class="text">
    						<option></option>
    						<logic:iterate id="choix" name="clients"
    							type="com.metier.Client" scope="session">
    							<option id="Client" value="<%= choix.getNom_Client() %>"><bean:write
    								name="choix" property="nom_Client" /></option>
    						</logic:iterate>
    					</select></td>
    				</tr>
    				<tr>
    					<td align="left" bgcolor="#999999" class="case1" scope="row">Date
    					début</td>
    					<td><input type="text" name="dateAffectationN" value=""
    						readonly="readonly" class="text" style="width: 140px" /> <html:img
    						src="Images/clr.PNG" title="Choisir la date début"
    						onclick="if(self.gfPop)gfPop.fPopCalendar(document.forms[2].elements['dateAffectationN']);return false;"
    						style="border-width:0;"></html:img></td>
    				</tr>
    				<tr>
    					<td align="left" bgcolor="#999999" class="case3" scope="row">Date
    					fin</td>
    					<td><input type="text" name="datedesaffN" value=""
    						readonly="readonly" class="text" style="width: 140px" /> <html:img
    						src="Images/clr.PNG" title="Choisir la date fin"
    						onclick="if(self.gfPop)gfPop.fPopCalendar(document.forms[2].elements['datedesaffN']);return false;"
    						style="border-width:0;"></html:img></td>
    				</tr>
    			</table>
     
    			<table width="387" border="0" align="left" cellpadding="0"
    				cellspacing="0">
    				<tr>
    					<th width="1" scope="row"><html:button property="nouvAFF"
    						value="Nouveau..." onclick="reset3()" /></th>
    					<td width="16">&nbsp;</td>
    					<td width="1">
    					<ajax:anchors target="ajaxFrame3" ajaxFlag="ajaxFrame3">
    					<html:button property="validaff" value="Valider"
    						onclick="testDat()" />
    					</ajax:anchors>
    						</td>
    					<td><input type="button" name="effAff" value="effacer" /></td>
    				</tr>
    			</table>
     
     
    	</html:form>
    Mais le problème reste le même et en plus de ça quand je fais une action toute la page est rechargé, pas seulement celle entouré par ajax:area.

    Remarque :
    Le IE détecte une erreur javaScript mais j’arrive pas a la trouvé, est ce que c’est une erreur dans une des fichiers javaScripte Ajax comme prototype.js ?

    Alors ou se trouve le problème de mon premier essaie, et comment je vais marché mon deuxième essaie ?

    je sais que mon message est long, mais j'ai besoin d'aide .Merci

  2. #2
    Nouveau Candidat au Club
    Inscrit en
    Mars 2008
    Messages
    1
    Détails du profil
    Informations forums :
    Inscription : Mars 2008
    Messages : 1
    Points : 1
    Points
    1
    Par défaut
    Il faut "simplement" donner une valeur différente pour chaque attribut id des différents display:table, comme tu as déjà fait pour ajax:displayTag.

    Voir pour cela la documentation de l'attribut uid (qui semble préféré à id):
    http://displaytag.sourceforge.net/10...-12.html#table

    Two tables in the same page can't have the same uid (paging and sorting will affect both).
    Je viens de résoudre la même erreur la semaine dernière.

Discussions similaires

  1. Problème avec org.apache.struts.taglib
    Par newmar dans le forum Struts 1
    Réponses: 1
    Dernier message: 22/02/2008, 16h55
  2. Réponses: 5
    Dernier message: 20/09/2007, 17h53
  3. problème avec le formulaire struts
    Par coyote999 dans le forum Struts 1
    Réponses: 2
    Dernier message: 04/04/2007, 09h11
  4. problème avec les action struts
    Par kevin75 dans le forum Struts 1
    Réponses: 4
    Dernier message: 22/09/2006, 10h24
  5. [VB.NET] Problème avec le Owner d'un form
    Par boulete dans le forum Windows Forms
    Réponses: 2
    Dernier message: 03/03/2006, 14h02

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