以下是我在JSP文件中的Java代码:
<%
Dbase db = new Dbase();
Connection conn = db.connect("jdbc:mysql://localhost:3306/fyp", "root", "");
ResultSet rs;
Statement stmt = conn.createStatement();
List<String> listDate = new ArrayList<String>();
List<Integer> listTemperature = new ArrayList<Integer>();
String query = "select date from weatherData;";
rs = stmt.executeQuery(query) ;
int i = 0;
while(rs.next()){
listDate.add(rs.getString(1));
out.println(listDate.get(i));
i++;
}
%>
我正在尝试将这些元素打印出来但却失败了。没错。可能有什么不对?