This is my screen
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Teste</title>
</h:head>
<h:body>
<p:outputLabel value="Nome:"/>
<h:inputText id="nome" value="#{controle.novo.nome}" />
<br/>
<p:outputLabel value="CPF:"/>
<h:inputText id="cpf" value="#{controle.novo.cpf}"/>
<br/>
<p:outputLabel value="RG:"/>
<h:inputText id="rg" value="#{controle.novo.rg}"/>
</h:body>
</html>
Class funcionario
public class Funcionario {
private String nome;
private String Cpf;
private int Rg;
public Funcionario(String nome, String Cpf, int Rg) {
this.nome = nome;
this.Cpf = Cpf;
this.Rg = Rg;
}
public Funcionario() {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCpf() {
return Cpf;
}
public void setCpf(String Cpf) {
this.Cpf = Cpf;
}
public int getRg() {
return Rg;
}
public void setRg(int Rg) {
this.Rg = Rg;
}
}
Class FuncionarioDao
public class FuncionarioDao {
private Conexao Con;
public FuncionarioDao(){
Con = new Conexao();
}
public Boolean salvarDados(Funcionario execute){
try {
String query = "insert into func (nome,cpf,rg) values(?,?,?)";
PreparedStatement stmt = Con.getConnection().prepareStatement(query);
stmt.setString(1, execute.getNome());
stmt.setString(2, execute.getCpf());
stmt.setInt(3, execute.getRg());
stmt.execute();
Con.getConnection().commit();
stmt.close();
return true;
} catch (SQLException ex) {
Logger.getLogger(FuncionarioDao.class.getName()).log(Level.SEVERE, null, ex);
}
return true;
}
}
Class Controle
@ManagedBean
@SessionScoped
public class Controle implements Serializable{
private Funcionario novo;
public Controle(){
novo = new Funcionario();
}
public boolean inserirFunc(Funcionario novoFun){
FuncionarioDao dao = new FuncionarioDao();
dao.salvarDados(novoFun);
return true;
}
public Funcionario getNovo() {
return novo;
}
public void setNovo(Funcionario novo) {
this.novo = novo;
}
}
The error I'm getting is:
Can not create instance for class: br.test.Control.Control.