Good morning,
I have the following error message. on line 23 and 24 of the UserID.class.
It says: Can not make a static reference to the non-static method from UserModel.
public class UsuarioDAO {
public static Boolean doLogin(UsuarioDAO usuario) {
PreparedStatement ps = null;
ResultSet rs = null;
String sql = "select * from usuario where nome=? and senha=?";
try {
// Validar
ps = ConectarDB.getConexao().prepareStatement(sql);
//UsuarioModel usuario = new UsuarioModel();
ps.setString(1, UsuarioModel.getNome());
ps.setString(2, usuarioModel.getSenha());
rs=ps.executeQuery();
// Validar
if(rs.next()) {
return true;
} else {
return false;
}
} catch (SQLException ex) {
ex.printStackTrace();
return false;
}
}
}
public class UsuarioModel {
// Variáveis
public String nome;
public String senha;
// Getters & Setters
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getSenha() {
return senha;
}
public void setSenha(String senha) {
this.senha = senha;
}
public UsuarioModel(String nome, String senha) {
this.nome = nome;
this.senha = senha;
}
}