Ola Pessoal,
estou com um problema com o framewor ZK, será q alguem pode me ajudar?!
tá dando o seguinte erro:
SEVERE: >>org.zkoss.zk.ui.UiException: Sourced file: inline evaluation of: verificarUsuario();'' : Typed variable declaration : Constructor error: Can't find constructor: br.gov.anatel.loja.vo.Login( java.lang.String ) in class: br.gov.anatel.loja.vo.Login : at Line: 10 : in file: inline evaluation of:import br.gov.anatel.loja.vo.Login; import br.gov.anatel.loja.dao.LoginDao; . . . ‘’ : new Login ( nome .value )
Called from method: verificarUsuario : at Line: 1 : in file: inline evaluation of: ``verificarUsuario();’’ : verificarUsuario ( )
Sourced file: inline evaluation of:
verificarUsuario();'' : Typed variable declaration : Constructor error: Can't find constructor: br.gov.anatel.loja.vo.Login( java.lang.String ) in class: br.gov.anatel.loja.vo.Login : at Line: 10 : in file: inline evaluation of:import br.gov.anatel.loja.vo.Login; import br.gov.anatel.loja.dao.LoginDao; . . . ‘’ : new Login ( nome .value )Called from method: verificarUsuario : at Line: 1 : in file: inline evaluation of: ``verificarUsuario();’’ : verificarUsuario ( ) at bsh.BSHAllocationExpression.constructObject(Unknown Source) at bsh.BSHAllocationExpression.objectAllocation(Unknown Source) at bsh.BSHAllocationExpression.eval(Unknown Source) at bsh.BSHPrimaryExpression.eval(Unknown Source) …
os meus códigos vem abaixo
logar.zul
<?page title="Loja Virtual" contentType="text/html;charset=UTF-8"?> import br.gov.anatel.loja.vo.Login; import br.gov.anatel.loja.dao.LoginDao; import java.util.ArrayList;LoginDao dao = new LoginDao();
List allEvents = dao.findAll();
void verificarUsuario(){
//insert into database
Login login = new Login(nome.value,senha.value);
dao.logar(login);
}
</groupbox>
LoginDao
package br.gov.anatel.loja.dao;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import br.gov.anatel.loja.dao.persistencia.BancoDB;
import br.gov.anatel.loja.dao.persistencia.LojaException;
import br.gov.anatel.loja.vo.Login;
public class LoginDao {
private static final String SQL_OBTER_AUTENTICACAO = "select * from login";
public List findAll() throws LojaException {
List allEvents = new ArrayList();
try {
Connection con = BancoDB.getInstance().obterConexao();
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(SQL_OBTER_AUTENTICACAO);
Login login;
while (rs.next()) {
login = new Login();
login.setId(rs.getInt(1));
login.setNome(rs.getString(2));
login.setSenha(rs.getString(3));
allEvents.add(login);
}
} catch (LojaException e) {
System.err.println(e.getMessage());
throw new LojaException("Erro no acesso aos dados");
} catch (SQLException e) {
System.err.println(e.getMessage());
throw new LojaException("Erro no acesso aos dados");
}
return allEvents;
}
public boolean logar(Login login) throws LojaException {
boolean result = false;
Connection con = null;
PreparedStatement stmt = null;
ResultSet st = null;
try {
con = BancoDB.getInstance().obterConexao();
stmt = con
.prepareStatement("select * from login where nome = ?");
stmt.setString(1, login.getNome());
stmt.setString(2, login.getSenha());
st = stmt.executeQuery();
if (st.next()) {
login.setNome(st.getString("nome"));
//login.setSenha(st.getString("senha"));
result = true;
}
} catch (LojaException e) {
System.err.println(e.getMessage());
throw new LojaException("Erro no acesso aos dados");
} catch (SQLException e) {
System.err.println(e.getMessage());
throw new LojaException("Erro no acesso aos dados");
} finally {
try {
if (stmt != null) {
stmt.close();
}
BancoDB.getInstance().fecharConexao(con);
} catch (SQLException e) {
System.err.println(e.getMessage());
throw new LojaException("Erro no acesso aos dados");
}
}
return result;
}
}
Login
package br.gov.anatel.loja.vo;
public class Login {
private int id;
private String nome;
private String senha;
public Login() {}
public Login(int id, String nome, String senha) {
this.id = id;
this.nome = nome;
this.senha = senha;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
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 void verificarUsuario(String nome,String senha) throws Exception {
// LoginController.isUsuarioValido(nome, senha);
// }
}
e é isso ai pessoal quem puder ajudar!!!
valeu!!!