Précédent   Forum des professionnels en informatique > Webmasters - Développement Web > JavaScript
JavaScript Forum programmation JavaScript. Lire : Cours JavaScript, FAQ JavaScript, Toutes les FAQ JavaScript et Sources JavaScript
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 13/05/2011, 21h44   #1
Invité de passage
 
mahdi mahdi
Inscription : décembre 2009
Messages : 4
Détails du profil
Informations personnelles :
Nom : mahdi mahdi

Informations forums :
Inscription : décembre 2009
Messages : 4
Points : 0
Points : 0
Par défaut charger de nouveau select

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..



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
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
mahdi0991 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 13/05/2011, 23h36   #2
Rédacteur/Modérateur
 
Avatar de andry.aime
 
Homme Andry Aimé
Inscription : septembre 2007
Messages : 5 128
Détails du profil
Informations personnelles :
Nom : Homme Andry Aimé
Localisation : Ile Maurice

Informations forums :
Inscription : septembre 2007
Messages : 5 128
Points : 7 270
Points : 7 270
Bonsoir,

Tes options n'ont pas d'attribut select. De plus, comme tu utilises struts, tu n'as qu'à utiliser une collection dans ton form et l'utiliser avec un optionsCollection.

A+.
andry.aime est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 13/05/2011, 23h49   #3
Invité de passage
 
mahdi mahdi
Inscription : décembre 2009
Messages : 4
Détails du profil
Informations personnelles :
Nom : mahdi mahdi

Informations forums :
Inscription : décembre 2009
Messages : 4
Points : 0
Points : 0
svp explique-moi de plus .. merci d'avance
mahdi0991 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 13h24.


 
 
 
 
Partenaires

Hébergement Web