Bonjour, j'utilise un code javascript dans un projet j2ee on utilisant framework Struts
lorsque on choisir le table , authomatiquement le colonnetable doit charger de base donné les colonne de tableau on le choisi .. je fait cet code , la page a charger lorsque on change le table mais il reste le table initial..
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
| function jvs(form){
form.table.options[0].text=liste.options[liste.selectedIndex].text;
}
<html:form action="/privilegeObjet" >
<table border="0" >
<tbody>
<tr>
<td>nom utilisateur</td>
<td><select name="user" title="insert the user here" >
<%
DbaConnection link = (DbaConnection) getServletContext().getAttribute("connection");
Vector<String> v = link.getusers();
for (int i = 0; i < v.size(); i++) {
out.println("<option>" + v.elementAt(i) + "</option>");
}
%>
</select> </td>
</tr>
<tr> <td> <span style='color:white'>---------------------------------------</span> </td></tr>
<tr>
<td>Table:</td> <td><html:select property="table" onchange="document.privilegeObjeteForm.submit();javascript:jvs(this.form)">
<%
v = link.nomtable("table");
for (int i = 0; i < v.size(); i++) {
out.println("<option>" + v.elementAt(i) + "</option>");
}
%>
</html:select></td>
</tr>
<tr>
<td>privilèges objets</td>
<td><select name="objettable">
<option>Alter</option>
<option>DELETE</option>
<option>INDEX</option>
<option>INSERT</option>
<option>REFERENCES</option>
<option>SELECT</option>
<option>UPDATE</option>
</select></td>
</tr>
<tr>
<td>colonne:</td>
<td><select name="colonne1" id="tablecolonne">
<%
try {
Vector<String> col = (Vector<String>) getServletContext().getAttribute("colonne");
if (col != null) {
for (int j = 0; j < col.size(); j++) {
out.println("<option>" + col.elementAt(j) + "</option>");
}
}
} catch (NullPointerException e) {
out.println("<option></option>");
}
%>
</select></td>
</tr>
<tr> <td> <span style='color:white'>---------------------------------------</span> </td></tr>
<tr>
</tbody>
</table>
</html:form> |
le probleme c'est comment faire nouvelle chargement de donné les colonne de la DB lorsque la changement de select table?? (dsl pour la mauvaise langage francaise par ce que je suis débutant )
merci d'avance
Partager