Boa Tarde Pessoal,
Tenho um form de cadastro q tem um método que ao clicar no navegador ele nao aciona e nem gera log. Alguém pode me ajudar?
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
template="../WEB-INF/template/padraoLogin.xhtml">
<ui:define name="titulo">
Sistema de Assistência Estudantil
</ui:define>
<ui:define name="corpo">
<div>
<h:outputLabel >
<h1>
Cadastrar Pessoa
</h1>
</h:outputLabel>
</div>
<h:form id="menucadastro">
<p:toolbar>
<p:toolbarGroup align="left">
<p:commandButton type="button" value="Novo" icon="ui-icon-document" />
<p:separator />
</p:toolbarGroup>
</p:toolbar>
<p:panelGrid columns="8" style="width:1333px" >
<h:outputLabel for="nome" value="Nome:" />
<p:inputText maxlength="50" style="width:270px;" value="#{pessoaControler.pessoaBean.nome}" id="nome" label="nome" required="true"/>
<h:outputLabel for="cpf" value="CPF:" />
<p:inputText maxlength="11" style="width:100px;" value="#{pessoaControler.pessoaBean.cpf}" id="cpf" label="cpf" required="true" />
<h:outputLabel for="identidade" value="Identidade:" />
<p:inputText id="identidade" maxlength="15" style="width:100px;" value="#{pessoaControler.pessoaBean.identidade}" label="identidade" required="true"/>
<h:outputLabel for="email" value="Email:" style="width:220px;" />
<p:inputText id="email" maxlength="50" value="#{pessoaControler.pessoaBean.email}" label="Email" required="true"/>
<h:outputLabel for="orgaoexpedidor" value="orgaoexpedidor" style="width:220px;" />
<p:inputText id="orgaoexpedidor" maxlength="50" value="#{pessoaControler.pessoaBean.orgaoExpedidor}" label="Email" required="true"/>
<h:outputLabel for="matricula" value="matricula" style="width:220px;" />
<p:inputText id="matricula" maxlength="50" value="#{pessoaControler.pessoaBean.matricula}" label="Email" required="true"/>
<h:outputLabel for="datanascimento" value="datanascimento" style="width:220px;" />
<p:inputText id="datanascimento" maxlength="50" value="#{pessoaControler.pessoaBean.dataNascimento}" label="Email" required="true"/>
<h:outputLabel for="sexo" value="Sexo" />
<p:selectOneRadio id="sexo" value="#{pessoaControler.pessoaBean.sexo}" required="true" styleClass="sem-Borda">
<f:selectItem itemLabel="Masc." itemValue="m" />
<f:selectItem itemLabel="Fem." itemValue="f"/>
</p:selectOneRadio>
<h:outputLabel for="estadoCivil" value="Estado Civil" />
<p:selectOneRadio id="estadoCivil" value="#{PessoaBean.estadocivil}" required="true" styleClass="sem-Borda">
<f:selectItem itemLabel="Casado." itemValue="c"/>
<f:selectItem itemLabel="Solteiro" itemValue="s"/>
<f:selectItem itemLabel="Divorciado" itemValue="d"/>
</p:selectOneRadio>
</p:panelGrid>
<p:panelGrid columns="8" style="width:1333px" >
<h:outputLabel value="telefoneresidencia" style="width:220px;" />
<p:inputText id="telefoneresidencial" maxlength="20" value="#{pessoaControler.pessoaBean.telefoneResidencial}" label="Telefone Residencial" />
<h:outputLabel value="telefonecelular" style="width:220px;" />
<p:inputText id="telefonecelular" maxlength="20" value="#{pessoaControler.pessoaBean.telefoneCelular}" label="Telefone Celular"/>
<h:outputLabel for="logradouro" value="logradouro" style="width:220px;" />
<p:inputText id="logradouro" maxlength="50" value="#{pessoaControler.pessoaBean.endLogradouro}" label="Logradouro" />
<h:outputLabel for="bairro" value="bairro" style="width:220px;" />
<p:inputText id="bairro" maxlength="50" value="#{pessoaControler.pessoaBean.endBairro}" label="Logradouro" />
<h:outputLabel for="numero" value="numero" style="width:220px;" />
<p:inputText id="numero" maxlength="50" value="#{pessoaControler.pessoaBean.endNumero}" label="numero" />
<h:outputLabel for="cep" value="cep" style="width:220px;" />
<p:inputText id="cep" maxlength="50" value="#{pessoaControler.pessoaBean.endCep}" label="Cep" />
<h:outputLabel for="cidade" value="cidade" style="width:220px;" />
<p:inputText id="cidade" maxlength="30" value="#{pessoaControler.pessoaBean.endCidade}" label="Cidade" />
<h:outputLabel for="uf" value="uf" style="width:220px;" />
<p:inputText id="uf" maxlength="20" value="#{pessoaControler.pessoaBean.endUf}" label="Unidade Federativa" />
<h:outputLabel for="complemento" value="complemento" style="width:220px;" />
<p:inputText id="complemento" maxlength="50" value="#{pessoaControler.pessoaBean.endComplemento}" label="Complemento" />
<f:facet name="footer" id="rodape">
<p:commandButton type="button" value="Cadastrar" icon="ui-icon-check" style="margin:0" action="#{pessoaControler.insereOuAltera()}" />
</f:facet>
</p:panelGrid>
</h:form>
<h:messages style="font-size: 1.5em; background-color: background;color: #ffffff;text-align: left" globalOnly="true" errorClass="erro"/>
</ui:define>
</ui:composition>[/code]
O método esta em meu Classe de controller
[code]
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.saes.pessoa.controler;
import com.saes.pessoa.bean.PessoaBean;
import com.saes.pessoa.facade.PessoaFacade;
import com.saes.pessoa.facade.PessoaFacadeImpl;
import com.saes.util.SistemaException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
/**
*
* @author cristofe.rocha
*/
@ManagedBean
@RequestScoped
public class PessoaControler {
private PessoaBean pessoaBean;
private PessoaFacadeImpl pessoaFacadeImpl;
private PessoaFacade pessoaFacade;
/**
* Creates a new instance of PessoaControle
*/
public PessoaControler() {
if (pessoaFacadeImpl == null) {
pessoaFacadeImpl = new PessoaFacadeImpl();
}
}
public PessoaBean getPessoaBean() {
return pessoaBean;
}
public void setPessoaBean(PessoaBean pessoaBean) {
this.pessoaBean = pessoaBean;
}
public PessoaFacadeImpl getPessoaFacadeImpl() {
return pessoaFacadeImpl;
}
public void setPessoaFacadeImpl(PessoaFacadeImpl pessoaFacadeImpl) {
this.pessoaFacadeImpl = pessoaFacadeImpl;
}
public PessoaFacade getPessoaFacade() {
return pessoaFacade;
}
public void setPessoaFacade(PessoaFacade pessoaFacade) {
this.pessoaFacade = pessoaFacade;
}
public String inserir() {
try {
pessoaFacadeImpl.inserir(pessoaBean);
return "home";
} catch (SistemaException ex) {
Logger.getLogger(PessoaControler.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
public String insereOuAltera() {
try {
pessoaFacadeImpl.insereOuAltera(pessoaBean);
return "home";
} catch (SistemaException ex) {
Logger.getLogger(PessoaControler.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
public String excluir() {
try {
pessoaFacadeImpl.excluir(pessoaBean);
return "regraNavegacao";
} catch (SistemaException ex) {
Logger.getLogger(PessoaControler.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
public String Selecionar(){
try {
pessoaFacadeImpl.selecionar(Integer.SIZE);
return "regradeNavegacao";
} catch (SistemaException ex) {
Logger.getLogger(PessoaControler.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
public String Listar(){
try {
pessoaFacadeImpl.listar();
} catch (SistemaException ex) {
Logger.getLogger(PessoaControler.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
}
[/code]
Segue meu Ben Pessoa
[code]
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.saes.pessoa.bean;
import com.saes.cargo.bean.CargoBean;
import java.io.Serializable;
import java.util.Calendar;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
/**
*
* @author cristofe.rocha
*/
@Entity
@Table(name="pessoa")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "type", discriminatorType = DiscriminatorType.STRING)
public class PessoaBean implements Serializable {
@Id
@SequenceGenerator(name = "seq_pessoa", sequenceName = "pessoa_codigo_seq")
@GeneratedValue(generator = "seq_pessoa")
private Integer codigo;
@Column (name = "nome")
private String nome;
@Column (name = "cpf")
private String cpf;
@Column (name = "identidade")
private String identidade;
public String getEstadocivil() {
return estadocivil;
}
public void setEstadocivil(String estadocivil) {
this.estadocivil = estadocivil;
}
@Column (name = "estadocivil")
private String estadocivil;
@Column(name = "orgaoexpedidor")
private String orgaoExpedidor;
@Column(name = "email")
private String email;
@Column(name = "datanascimento")
@Temporal(value = javax.persistence.TemporalType.DATE)
private Calendar dataNascimento;
@Column(name = "matricula")
private String matricula;
@Column(name = "telefoneresidencial")
private String telefoneResidencial;
@Column(name = "telefonecelular")
private String telefoneCelular;
@Column(name = "endlogradouro")
private String endLogradouro;
@Column(name = "endcidade")
private String endCidade;
@Column(name = "enduf")
private String endUf;
@Column(name = "sexo")
private String sexo;
@Column(name = "endcomplemento")
private String endComplemento;
@Column(name = "endbairro")
private String endBairro;
@Column(name = "endnumero")
private String endNumero;
@Column(name = "endcep")
private String endCep;
@ManyToOne
@JoinColumn (name = "codcargo")
private CargoBean cargo;
public String getSexo() {
return sexo;
}
public void setSexo(String sexo) {
this.sexo = sexo;
}
public Integer getCodigo() {
return codigo;
}
public void setCodigo(Integer codigo) {
this.codigo = codigo;
}
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 String getIdentidade() {
return identidade;
}
public void setIdentidade(String identidade) {
this.identidade = identidade;
}
public String getOrgaoExpedidor() {
return orgaoExpedidor;
}
public void setOrgaoExpedidor(String orgaoExpedidor) {
this.orgaoExpedidor = orgaoExpedidor;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Calendar getDataNascimento() {
return dataNascimento;
}
public void setDataNascimento(Calendar dataNascimento) {
this.dataNascimento = dataNascimento;
}
public String getMatricula() {
return matricula;
}
public void setMatricula(String matricula) {
this.matricula = matricula;
}
public String getTelefoneResidencial() {
return telefoneResidencial;
}
public void setTelefoneResidencial(String telefoneResidencial) {
this.telefoneResidencial = telefoneResidencial;
}
public String getTelefoneCelular() {
return telefoneCelular;
}
public void setTelefoneCelular(String telefoneCelular) {
this.telefoneCelular = telefoneCelular;
}
public String getEndLogradouro() {
return endLogradouro;
}
public void setEndLogradouro(String endLogradouro) {
this.endLogradouro = endLogradouro;
}
public String getEndCidade() {
return endCidade;
}
public void setEndCidade(String endCidade) {
this.endCidade = endCidade;
}
public String getEndUf() {
return endUf;
}
public void setEndUf(String endUf) {
this.endUf = endUf;
}
public String getEndComplemento() {
return endComplemento;
}
public void setEndComplemento(String endComplemento) {
this.endComplemento = endComplemento;
}
public String getEndBairro() {
return endBairro;
}
public void setEndBairro(String endBairro) {
this.endBairro = endBairro;
}
public String getEndNumero() {
return endNumero;
}
public void setEndNumero(String endNumero) {
this.endNumero = endNumero;
}
public String getEndCep() {
return endCep;
}
public void setEndCep(String endCep) {
this.endCep = endCep;
}
public CargoBean getCargo() {
return cargo;
}
public void setCargo(CargoBean cargo) {
this.cargo = cargo;
}
@Override
public int hashCode() {
int hash = 5;
hash = 11 * hash + (this.codigo != null ? this.codigo.hashCode() : 0);
hash = 11 * hash + (this.nome != null ? this.nome.hashCode() : 0);
hash = 11 * hash + (this.cpf != null ? this.cpf.hashCode() : 0);
hash = 11 * hash + (this.identidade != null ? this.identidade.hashCode() : 0);
hash = 11 * hash + (this.email != null ? this.email.hashCode() : 0);
hash = 11 * hash + (this.dataNascimento != null ? this.dataNascimento.hashCode() : 0);
hash = 11 * hash + (this.matricula != null ? this.matricula.hashCode() : 0);
hash = 11 * hash + (this.telefoneResidencial != null ? this.telefoneResidencial.hashCode() : 0);
hash = 11 * hash + (this.telefoneCelular != null ? this.telefoneCelular.hashCode() : 0);
hash = 11 * hash + (this.endLogradouro != null ? this.endLogradouro.hashCode() : 0);
hash = 11 * hash + (this.endCidade != null ? this.endCidade.hashCode() : 0);
hash = 11 * hash + (this.endUf != null ? this.endUf.hashCode() : 0);
hash = 11 * hash + (this.endComplemento != null ? this.endComplemento.hashCode() : 0);
hash = 11 * hash + (this.endBairro != null ? this.endBairro.hashCode() : 0);
hash = 11 * hash + (this.endNumero != null ? this.endNumero.hashCode() : 0);
hash = 11 * hash + (this.endCep != null ? this.endCep.hashCode() : 0);
hash = 11 * hash + (this.cargo != null ? this.cargo.hashCode() : 0);
hash = 11 * hash + (this.orgaoExpedidor != null ? this.orgaoExpedidor.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final PessoaBean other = (PessoaBean) obj;
if (this.codigo != other.codigo && (this.codigo == null || !this.codigo.equals(other.codigo))) {
return false;
}
if ((this.nome == null) ? (other.nome != null) : !this.nome.equals(other.nome)) {
return false;
}
if ((this.cpf == null) ? (other.cpf != null) : !this.cpf.equals(other.cpf)) {
return false;
}
if ((this.identidade == null) ? (other.identidade != null) : !this.identidade.equals(other.identidade)) {
return false;
}
if ((this.orgaoExpedidor == null) ? (other.orgaoExpedidor != null) : !this.orgaoExpedidor.equals(other.orgaoExpedidor)) {
return false;
}
if ((this.email == null) ? (other.email != null) : !this.email.equals(other.email)) {
return false;
}
if (this.dataNascimento != other.dataNascimento && (this.dataNascimento == null || !this.dataNascimento.equals(other.dataNascimento))) {
return false;
}
if ((this.matricula == null) ? (other.matricula != null) : !this.matricula.equals(other.matricula)) {
return false;
}
if ((this.telefoneResidencial == null) ? (other.telefoneResidencial != null) : !this.telefoneResidencial.equals(other.telefoneResidencial)) {
return false;
}
if ((this.telefoneCelular == null) ? (other.telefoneCelular != null) : !this.telefoneCelular.equals(other.telefoneCelular)) {
return false;
}
if ((this.endLogradouro == null) ? (other.endLogradouro != null) : !this.endLogradouro.equals(other.endLogradouro)) {
return false;
}
if ((this.endCidade == null) ? (other.endCidade != null) : !this.endCidade.equals(other.endCidade)) {
return false;
}
if ((this.endUf == null) ? (other.endUf != null) : !this.endUf.equals(other.endUf)) {
return false;
}
if ((this.endComplemento == null) ? (other.endComplemento != null) : !this.endComplemento.equals(other.endComplemento)) {
return false;
}
if ((this.endBairro == null) ? (other.endBairro != null) : !this.endBairro.equals(other.endBairro)) {
return false;
}
if ((this.endNumero == null) ? (other.endNumero != null) : !this.endNumero.equals(other.endNumero)) {
return false;
}
if ((this.endCep == null) ? (other.endCep != null) : !this.endCep.equals(other.endCep)) {
return false;
}
if (this.cargo != other.cargo && (this.cargo == null || !this.cargo.equals(other.cargo))) {
return false;
}
return true;
}
}
[/code]
meu Facade
[code]/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.saes.pessoa.facade;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.saes.pessoa.bean.PessoaBean;
import com.saes.pessoa.dao.PessoaDaoImpl;
import com.saes.util.DaoException;
import com.saes.util.SistemaException;
import java.util.Collection;
/**
*
* @author cristofe.rocha
*/
public class PessoaFacadeImpl implements PessoaFacade {
private PessoaDaoImpl pessoaDaoImp;
public PessoaFacadeImpl() {
if (pessoaDaoImp == null) {
pessoaDaoImp = new PessoaDaoImpl();
}
}
@Override
public PessoaBean pesquisarNome(String nome) throws SistemaException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public PessoaBean inserir(PessoaBean obj) throws SistemaException {
try {
return pessoaDaoImp.inserir(obj);
} catch (DaoException ex) {
Logger.getLogger(PessoaFacadeImpl.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
@Override
public PessoaBean alterar(PessoaBean obj) throws SistemaException {
try {
return pessoaDaoImp.alterar(obj);
} catch (DaoException ex) {
Logger.getLogger(PessoaFacadeImpl.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
@Override
public Boolean excluir(PessoaBean obj) throws SistemaException {
try {
return pessoaDaoImp.excluir(obj);
} catch (DaoException ex) {
Logger.getLogger(PessoaFacadeImpl.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
@Override
public PessoaBean selecionar(Integer id) throws SistemaException {
try {
return pessoaDaoImp.selecionar(id);
} catch (DaoException ex) {
Logger.getLogger(PessoaFacadeImpl.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
@Override
public PessoaBean insereOuAltera(PessoaBean obj) throws SistemaException {
try {
return pessoaDaoImp.insereOuAltera(obj);
} catch (DaoException ex) {
Logger.getLogger(PessoaFacadeImpl.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
@Override
public Collection<PessoaBean> listar() throws SistemaException {
try {
return pessoaDaoImp.listar();
} catch (DaoException ex) {
Logger.getLogger(PessoaFacadeImpl.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
}
Mas infelizmente não gera log em meu console. Não sei o q esta havendo . Alguém pode me ajudar…???