2
Good morning,
I have a following error warning. on line 23 and 24 of the User.class.
Says: Cannot make a Static Reference to the non-static method from User.
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;
}
}