Created
April 15, 2016 13:43
-
-
Save kkrico/f5cb5b8447d2896f730efde359d53c0a to your computer and use it in GitHub Desktop.
LTP III
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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:ui="http://xmlns.jcp.org/jsf/facelets" | |
template="./modelo.xhtml" | |
xmlns:h="http://xmlns.jcp.org/jsf/html" | |
xmlns:p="http://primefaces.org/ui" | |
xmlns:f="http://xmlns.jcp.org/jsf/core"> | |
<ui:define name="content"> | |
<h:form id="formpjur"> | |
<p:outputLabel style="font-size: 3em">Pessoa Juridica</p:outputLabel> | |
<hr/> | |
<p:panelGrid columns="2"> | |
<p:outputLabel value="Nome"></p:outputLabel> | |
<p:inputText id="nome" value="#{pessoabean.pessoaJuridica.nome}"></p:inputText> | |
<p:outputLabel value="CNPJ"></p:outputLabel> | |
<p:inputText id="cnpj" value="#{pessoabean.pessoaJuridica.cnpj}"></p:inputText> | |
<br/> | |
<p:commandLink value="Enviar" action="#{pessoabean.salvarPessoaJuridica}"/> | |
</p:panelGrid> | |
</h:form> | |
</ui:define> | |
</ui:composition> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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:ui="http://xmlns.jcp.org/jsf/facelets" | |
template="./modelo.xhtml"> | |
<ui:define name="content"> | |
<h1>Bem vindo ao cadastro Aluno</h1> | |
</ui:define> | |
</ui:composition> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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:ui="http://xmlns.jcp.org/jsf/facelets" | |
xmlns:h="http://xmlns.jcp.org/jsf/html" | |
xmlns:p="http://primefaces.org/ui"> | |
<h:head> | |
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | |
<h:outputStylesheet name="./css/default.css"/> | |
<h:outputStylesheet name="./css/cssLayout.css"/> | |
<title>Tarefa Avaliativa II</title> | |
</h:head> | |
<h:body> | |
<div id="top" class="top"> | |
<ui:insert name="top">Top</ui:insert> | |
</div> | |
<div> | |
<div id="left"> | |
<h:form id="form"> | |
<p:panelGrid columns="1"> | |
<h:commandLink action="index" value="Home"></h:commandLink> | |
<h:commandLink action="cadastropfis" value="Cadastrar Pessoa Fisica"></h:commandLink> | |
<h:commandLink action="cadastropjur" value="Cadastrar Pessoa Juridica"></h:commandLink> | |
<h:commandLink action="listpfis" value="Listar Pessoa Fisica"></h:commandLink> | |
<h:commandLink action="listpjur" value="Listar Pessoa Juridica"></h:commandLink> | |
</p:panelGrid> | |
</h:form> | |
</div> | |
<div id="content" class="left_content"> | |
<ui:insert name="content">Content</ui:insert> | |
</div> | |
</div> | |
</h:body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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.kkrico.controller; | |
import com.kkrico.model.PessoaFisica; | |
import com.kkrico.model.PessoaJuridica; | |
import java.io.Serializable; | |
import java.util.ArrayList; | |
import java.util.Collection; | |
import javax.faces.bean.ManagedBean; | |
import javax.faces.bean.SessionScoped; | |
/** | |
* | |
* @author kkrico | |
*/ | |
@ManagedBean(name = "pessoabean") | |
@SessionScoped | |
public class PessoaBean implements Serializable { | |
private PessoaFisica pessoaFisica; | |
private PessoaJuridica pessoaJuridica; | |
private Collection<PessoaJuridica> pessoasJuridicas; | |
private Collection<PessoaFisica> pessoasFisicas; | |
public PessoaBean() { | |
pessoaFisica = new PessoaFisica(); | |
pessoaJuridica = new PessoaJuridica(); | |
pessoasFisicas = new ArrayList<PessoaFisica>(); | |
pessoasJuridicas = new ArrayList<PessoaJuridica>(); | |
} | |
public PessoaFisica getPessoaFisica() { | |
return pessoaFisica; | |
} | |
public void setPessoaFisica(PessoaFisica pessoaFisica) { | |
this.pessoaFisica = pessoaFisica; | |
} | |
public PessoaJuridica getPessoaJuridica() { | |
return pessoaJuridica; | |
} | |
public void setPessoaJuridica(PessoaJuridica pessoaJuridica) { | |
this.pessoaJuridica = pessoaJuridica; | |
} | |
public Collection getPessoasJuridicas() { | |
return pessoasJuridicas; | |
} | |
public void setPessoasJuridicas(Collection pessoasJuridicas) { | |
this.pessoasJuridicas = pessoasJuridicas; | |
} | |
public Collection getPessoasFisicas() { | |
return pessoasFisicas; | |
} | |
public void setPessoasFisicas(Collection pessoasFisicas) { | |
this.pessoasFisicas = pessoasFisicas; | |
} | |
public String salvarPessoaJuridica() { | |
pessoasJuridicas.add(pessoaJuridica); | |
pessoaJuridica = new PessoaJuridica(); | |
return "listpjur"; | |
} | |
public String salvarPessoaFisica() { | |
pessoasFisicas.add(pessoaFisica); | |
pessoaFisica = new PessoaFisica(); | |
return "listpfis"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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.kkrico.model; | |
import java.io.Serializable; | |
import java.util.Date; | |
/** | |
* | |
* @author kkrico | |
*/ | |
public class PessoaFisica implements Serializable { | |
private String nome; | |
private String cpf; | |
private Date dataNascimento; | |
private String sexo; | |
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 Date getDataNascimento() { | |
return dataNascimento; | |
} | |
public void setDataNascimento(Date dataNascimento) { | |
this.dataNascimento = dataNascimento; | |
} | |
public String getSexo() { | |
return sexo; | |
} | |
public void setSexo(String sexo) { | |
this.sexo = sexo; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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.kkrico.model; | |
import java.io.Serializable; | |
/** | |
* | |
* @author kkrico | |
*/ | |
public class PessoaJuridica implements Serializable { | |
private String nome; | |
private String cnpj; | |
public String getNome() { | |
return nome; | |
} | |
public void setNome(String nome) { | |
this.nome = nome; | |
} | |
public String getCnpj() { | |
return cnpj; | |
} | |
public void setCnpj(String cnpj) { | |
this.cnpj = cnpj; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" | |
xmlns:h="http://java.sun.com/jsf/html" | |
xmlns:f="http://java.sun.com/jsf/core" | |
xmlns:ui="http://java.sun.com/jsf/facelets" | |
xmlns:p="http://primefaces.org/ui"> | |
<h:head> | |
<f:facet name="first"> | |
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> | |
<title>Novo Cliente - Avaliação LTPIII </title> | |
</f:facet> | |
</h:head> | |
<h:body> | |
<h1>Novo Cliente</h1> | |
<hr /> | |
<h:form id="form"> | |
<p:messages autoUpdate="false" /> | |
<p:panelGrid columns="2" id="pGrid"> | |
<p:outputLabel value="Nome:"></p:outputLabel> | |
<p:inputText id="nome" placeholder="Seu nome" value="#{clientebean.cliente.nome}"></p:inputText> | |
<p:outputLabel value="CPF:" for="cpf"></p:outputLabel> | |
<p:inputMask mask="999.999.999-99" placeholder="999.999.999-99" id="cpf" value="#{clientebean.cliente.cpf}"></p:inputMask> | |
<p:outputLabel value="Email:" for="email"></p:outputLabel> | |
<p:inputText id="email" value="#{clientebean.cliente.email}" placeholder="seuemail@mail.com"/> | |
<p:outputLabel value="Telefone:" for="telefone"></p:outputLabel> | |
<p:inputMask mask="(99) 9999-9999" placeholder="(99) 9999-9999" id="telefone" value="#{clientebean.cliente.telefone}"></p:inputMask> | |
<p:outputLabel value="Data de Nascimento"></p:outputLabel> | |
<p:calendar pattern="dd/MM/yyyy" placeholder="dd/mm/yyyy" value="#{clientebean.cliente.dataNascimento}"></p:calendar> | |
<p:outputLabel value="Sexo"></p:outputLabel> | |
<p:selectOneRadio value="#{clientebean.cliente.sexo}"> | |
<f:selectItem itemLabel="Masculino" itemValue="masculino"/> | |
<f:selectItem itemLabel="Feminino" itemValue="feminino"/> | |
</p:selectOneRadio> | |
<p:outputLabel value="Nacionalidade"></p:outputLabel> | |
<p:selectOneMenu value="#{clientebean.cliente.nacionalidade}"> | |
<f:selectItem itemLabel="Brasileira" itemValue="brasileira"/> | |
<f:selectItem itemLabel="Argentina" itemValue="argentina"/> | |
<f:selectItem itemLabel="Alemã" itemValue="alema"/> | |
</p:selectOneMenu> | |
<p:outputLabel value="Estado Civil"></p:outputLabel> | |
<p:selectOneListbox value="#{clientebean.cliente.estadoCivil}"> | |
<f:selectItem itemLabel="Solteiro" itemValue="brasileira"></f:selectItem> | |
<f:selectItem itemLabel="Casado" itemValue="solteiro"></f:selectItem> | |
<f:selectItem itemLabel="Viuvo" itemValue="viuvo"></f:selectItem> | |
</p:selectOneListbox> | |
</p:panelGrid> | |
<br/> | |
<p:commandButton id="salvar" value="Salvar" action="#{clientebean.salvar}" process="@this pGrid" update="form"></p:commandButton> | |
<p:commandButton value="Cancelar" type="reset" immediate="true"></p:commandButton> | |
<br/> | |
<br/> | |
<p:dataTable id="itenstable" value="#{clientebean.clientes}" var="c" emptyMessage="Não há clientes cadastrados"> | |
<p:column headerText="Nome"> | |
<h:outputText value="#{c.nome}"></h:outputText> | |
</p:column> | |
<p:column headerText="CPF"> | |
<h:outputText value="#{c.cpf}"></h:outputText> | |
</p:column> | |
<p:column headerText="Data de Nascimento"> | |
<h:outputText value="#{c.dataNascimento}" ></h:outputText> | |
</p:column> | |
<p:column headerText="Telefone"> | |
<h:outputText value="#{c.telefone}"></h:outputText> | |
</p:column> | |
</p:dataTable> | |
</h:form> | |
</h:body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment