Perte des données après une clic sur bouton
Bonjours tout le monde,
Mon souci est le suivant:
J'ai une page jsp qui contient 3 listes <html:select>, l'une dépends de l'autre. La première permet de remplir la 2 ème et ainsi de suite, jusqu'à l'obtention d'un tableau contenant les données souhaitées.
Mais pour avoir ces dernières je dois cliquer sur un bouton <html:submit>.
Le problème est lorsque je clique sur ce bouton je perds toutes les données des listes.
Voici le code de ma page jsp en utilisant Struts 1.3, Hibernate 3, Tag-lib AJAX:
Code:
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
| <%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib uri="http://ajaxtags.sourceforge.net/tags/ajaxtags"
prefix="ajax"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<!--- body --->
<div align="center">
<p align="left"><html:link action="/module0">+ Nouveau Module</html:link></p>
<table>
<html:form action="/moduleSelect">
<table align="center" width="40%">
<!--<tr>
<td width="200"><span class="titre">La direction de :
<bean:write name="user" property="direction.libelleDr"/></span></td>
</tr>
-->
<tr>
<td>
<font size="2"> Direction </font>
</td>
<td>
<html:select property="codeDr" styleId="codeDr"
styleClass="select0" errorStyleClass="erreur2">
<html:option value="0-0">- - - Toutes les directions - - -</html:option>
<html:optionsCollection property="directions" label="libelleDr"
value="codeDr" />
</html:select>
</td>
<td>
<font size="2"> Etablissement </font>
</td>
<td></td>
<td>
<html:select property="codeEfp" styleId="codeEfp"
styleClass="select0" errorStyleClass="erreur2">
<html:option value="0-0">- - - Tous les établissements - - -</html:option>
<html:optionsCollection property="etablissements"
label="libelleEfp" value="codeEfp" />
</html:select>
</td>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr></tr>
<tr>
<td>
<font size="2"> Filières </font>
</td>
<td>
<html:select property="codeFiliere" styleId="codeFiliere"
styleClass="select0" errorStyleClass="erreur2">
<html:option value="0-0">- - - Toutes les filières - - -</html:option>
<html:optionsCollection property="filieres"
value="id.filiere.codeFiliere" label="id.filiere.libelleFiliere" />
</html:select>
</td>
</tr>
<tr align="right">
<td align="right" width="100">
<html:submit value="Lister les modules"
onclick="/modulefiliereAjax" />
</td>
</tr>
<tr></tr>
<tr></tr>
</table>
</br>
</html:form>
</table>
<logic:present name="modules">
<table align="center" cellpadding="0" cellspacing="1"
class="dataTable" width="52%">
<tr class="header">
<td>
<bean:message key="CODE_MODULE" />
</td>
<td>
<bean:message key="LIBELLE_MODULE" />
</td>
<td width="5%">
</td>
<td width="5%">
</td>
</tr>
<%
int i = 0;
%>
<logic:iterate id="module" name="modules">
<%
i++;
if (i % 2 == 0) {
%>
<tr bgcolor="#F3F3F3" onmouseover="this.bgColor ='#999999';"
onmouseout="this.bgColor='#F3F3F3';">
<%
} else {
%>
<tr bgcolor="#FFFFFF" onmouseover="this.bgColor ='#999999';"
onmouseout="this.bgColor='#FFFFFF';">
<%
}
%>
<td align="center">
<bean:write name="module" property="codeM" />
</td>
<td align="center">
<bean:write name="module" property="libellem" />
</td>
<td align="center">
<html:link href="moduleEdit.do" paramName="module"
paramProperty="codeM" paramId="codeM">
<html:img page="/images/edit.gif" title="Modifier" />
</html:link>
</td>
<td align="center">
<html:link href="moduleDelete.do" paramName="module"
paramProperty="codeM" paramId="codeM"
onclick="return confirm('Etes-vous sûr de vouloir supprimer ce module ?')">
<html:img page="/images/supprimer.gif" title="Supprimer" />
</html:link>
</td>
</tr>
</logic:iterate>
</table>
</logic:present>
</div>
<ajax:select baseUrl="efpDirectionAjax.do" source="codeDr"
target="codeEfp" parameters="codeDr={codeDr}" />
<ajax:select baseUrl="filiereEFPAjax.do" source="codeEfp"
target="codeFiliere" parameters="codeEfp={codeEfp}" />
<ajax:select baseUrl="modulefiliereAjax.do" source="codeFiliere"
target="codeM" parameters="codeFiliere={codeFiliere}" /> |
Merci d'avoir m'aidé à résoudre ce problème