我在 netBeans 中创建了一个登录系统。当 login.jsp 开始加载时,我有 index.jsp 和一个调用 login.jsp (你在下面看到的)的表单,它从未完成加载,加载循环一直在进行,然后 Tomcat 告诉我这可能会导致内存泄漏,想法?
<%
Connection connectionDB = null;
PreparedStatement psDB = null;
ResultSet rsDB = null;
String getUsername = request.getParameter("loginUsername");
String getPassword = request.getParameter("loginPassword");
String sql = "SELECT Username, Password FROM SKAWEB WHERE Username= '" +
getUsername + "' AND Password='" + getPassword + "'";
String driverName = "com.mysql.jdbc.driver";
String DATABASE_URL = "jdbc:mysql://localhost:1527/SKAWEB";
String userDB = "emmron";
String passDB = "test";
out.println("testing123");
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
try {
connectionDB = DriverManager.getConnection(DATABASE_URL, userDB, passDB);
psDB = connectionDB.prepareStatement(sql);
rsDB = psDB.executeQuery();
out.println("hello");
if(rsDB.next()) {
out.println("yay");
}
}
catch (Exception errorMessage) {
errorMessage.printStackTrace();
out.println("blah");
}
%>