je voulais remplir une liste déroulante à partir d'une autre
voici mon code:
ma page index:
ma page fill_liste:
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 <script> $(document).ready(function() { $("#dest").change(function() { var value = $(this).val(); $.get("fill_list.jsp",{country:value},function(data){ $("#operator").html(data); }); }); }); </script> <select class="selection" name="destination" id="dest" > <option value="">Toutes les destinations</option> <option th:each="item : ${country_select}" th:value="${item.id}" th:text="${item.country}"></option> </select> <select class="selection" name="operator" id="operator"> <option value="">Tous les opérateurs</option> <option th:each="item : ${operator_select}" th:value="${item.abreviation}" th:text="${item.name}+' / ' + ${item.abreviation}"></option> </select>
mais les annotations ne sont pas connues dans ma page 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
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 <%@page import="java.sql.*"%> <%@page import="java.util.ArrayList"%> <%@page import="java.util.List"%> <%@page import=" org.springframework.beans.factory.annotation.Autowired"%> <%@page import=" org.springframework.context.annotation.Configuration"%> <% @Configuration @Autowired DataSource oracle_dataSource; String country=request.getParameter("country"); String buffer="<select name='state' ><option value='-1'>Select</option>"; try { Statement stmt = oracle_dataSource.getConnection().createStatement(); ResultSet rs = stmt.executeQuery(" SELECT * FROM network_operator o JOIN daily_summary d " +" ON o.id=d.network_operator_id WHERE d.origina.country_id='"+country+"' " +" OR d.destination_country_id='"+country+"'"); while(rs.next()) { buffer=buffer+"<option value='"+rs.getString(1)+"'>"+rs.getString(3)+"</option>"; } buffer=buffer+"</select>"; } catch(Exception e){ } %>
où est le problème, sachant que ma page fill_list se trouve dans le même dossier que ma page index
Merci à vous
Partager