【发布时间】:2020-09-02 08:36:20
【问题描述】:
我已经尝试了一些变体,我当然导入了包含我在我的 Servlet 中使用的布尔方法的类,但它仍然看不到该方法。
这是我的类logIN中的方法:
MyCon = Database.getConnection();
boolean result = false;
Statement statement = null;
ResultSet resultSet = null;
try {
String sql = "SELECT * FROM input_form WHERE username ='"+username+"'AND password='"+password+"'";
statement=MyCon.createStatement();
resultSet = statement.executeQuery(sql);
if (resultSet.next()) {
result=true;
}else {
result = false;
}
} catch (SQLException e) {
}
return result;
}
} ```
And when i need to access that method in servlet, it doesnt see it :
```protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String username = request.getParameter("username");
String password = request.getParameter("password");
response.setContentType("text/html/charset-UTF-8");
out =response.getWriter();
boolean login = processLogin(username,password); //this is where it doesnt see it
```
what could i do for my servlet to see the method?
【问题讨论】: