如图所示 查询不成 这个是用来查询账号密码用的 他那句话下边说的啥意思
package review.controller;
import review.dao.dataBaseUtil;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
// session.setAttribute("account",account);
request.setAttribute("account", account);
} else {
System.out.println("登录失败");
// request.getRequestDispatcher("/loginsuccess.jsp").forward(request, response);
response.sendRedirect(request.getContextPath() + "/index.jsp");
}
} catch (SQLException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
finally {
try {
if (pstmt != null) {
pstmt.close();
}
if (conn != null) {
conn.close();
}
if (rs!=null){
rs.close();
}
} catch (SQLException e) {
e.printStackTrace();
System.out.println("释放资源发生异常");
}
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
}
查询语句加上 ‘?’ ‘’ 因为它是字符串