我找不到结果不会打印的原因。
需要专家的帮助。即使getString
中的数据类型为int,也可以使用mysql
。
<%@page import="java.util.ArrayList"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@page import="java.sql.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException ex) {
//out.println("DRIVER NOT FOUND");
}
Connection connection = null;
Statement statement = null;
ResultSet resultSet2 = null;
try {
connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/eenrol", "root", "");
statement = connection.createStatement();
resultSet2 = statement.executeQuery("SELECT IDNumber FROM student where status='pending'");
} catch (Exception sql) {
response.sendRedirect("studProfilePage.jsp");
}
try {
ArrayList studList = new ArrayList();
int rs = 0;
while(resultSet2.next()){
rs = resultSet2.getInt("IDNumber");
studList.add(rs);
request.setAttribute("pend", rs);
request.getRequestDispatcher("studProfilePage.jsp").forward(request, response);
}
} catch (Exception e){
e.printStackTrace();
}
%>
答案 0 :(得分:0)