Skip to content

Instantly share code, notes, and snippets.

@sednem
sednem / cadastrar.xhtml
Created October 18, 2013 16:44
Cadastrar Usuario
<!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://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
</h:head>
<body>
<h:form id="formUsuario" prependId="false">
<h:graphicImage id="img" library="default" value="img/livro.png" />
@sednem
sednem / UsuarioMBean.java
Created October 18, 2013 16:35
Usuário Managed Bean
package br.ufpe.jsf;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import javax.faces.application.FacesMessage;
@sednem
sednem / mensagens.properties
Created October 18, 2013 16:29
mensagens.properties
nome=Nome
senha=Senha
conf.senha=Conf. Senha
data.nascimento=Data de Nascimento
email=E-mail
sexo=Sexo
sexo.masculino=Masculino
sexo.feminino=Feminino
usuario=Usu\u00E1rio
cadastrar.usuario=Cadastrar Usu\u00E1rio
@sednem
sednem / index.xhtml
Created October 17, 2013 18:01
index.xhtml
<?xml version="1.0" encoding="UTF-8" ?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>JSF 2.2</title>
</h:head>
<h:body>
<h:outputText value="#{meuBean.texto}"/>
<h:commandButton value="Blah!" />
@sednem
sednem / faces-config.xml
Created October 17, 2013 17:00
faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
version="1.2">
</faces-config>
@sednem
sednem / context.xml
Created December 6, 2012 19:07
Configuração Tomcat para Spring
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
@sednem
sednem / TesteJPA.java
Created December 6, 2012 18:01
Classe de Teste JPA
package br.ufpe.nti.dao;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;
@sednem
sednem / GenericDAO.java
Created December 6, 2012 17:10
DAO Genérico
package br.ufpe.nti.dao;
import java.io.Serializable;
import java.util.List;
public interface GenericDAO<T, I extends Serializable>{
/**
* Persiste um objeto
* @param object
@sednem
sednem / Autor.java
Created December 6, 2012 17:09
Classes mapeada com JPA
package br.ufpe.nti.entity;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
@sednem
sednem / properies_en.properties
Created October 28, 2012 17:34
Properties en
#mensagens_en.properties
nome=Name
senha=Password
conf.senha=Check Password
data.nascimento=Date of Birth
email=E-mail
sexo=Sex
sexo.masculino=Male
sexo.feminino=Female
usuario=User