<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1638425322236587217</id><updated>2026-10-25T06:47:40.979-07:00</updated><category term="Eclipse"/><category term="JSF"/><category term="Java"/><category term="JBoss"/><category term="JSP e Servlet"/><category term="MySQL"/><category term="Netbeans"/><category term="TomCat"/><category term="EJB"/><category term="GlassFish"/><category term="Hibernate"/><category term="AJAX"/><category term="Google"/><category term="JQuery"/><category term="Linux"/><category term="Ubuntu"/><category term="Facelets"/><category term="Relatório"/><category term="Spring"/><category term="Struts"/><category term="Util"/><title type='text'>Jabes Felipe</title><subtitle type='html'>Liberte-se! nada pode te acorrentar</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>25</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-3337998946513833558</id><published>2011-10-16T13:02:00.000-07:00</published><updated>2011-10-16T14:45:28.873-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="JSP e Servlet"/><category scheme="http://www.blogger.com/atom/ns#" term="Spring"/><category scheme="http://www.blogger.com/atom/ns#" term="TomCat"/><title type='text'>Exemplo CRUD Spring com JDBC Template e Servlet/JSP</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Neste post, vamos estudar um dos Frameworks que é líder no mercado em aplicações JEE.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Estou falando do Spring Framework, que foi desenvolvido por Rod Johnson, e é mantido pela empresa&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Interface21. Este Framework oferece vários benefícios, possui módulos bem diversificados e pode&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;ser usado em diversos cenários.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;No nosso caso, vamos focar em um dos principais recursos do Spring que é o container de IoC&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;(Inversion of Control), que também é conhecido como DI (Dependency Injection), a idéia da DI&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;é de separar uma Interface da classe que a implementa, nos exemplos de DI deste tutorial será&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;aplicado a injeção através de métodos Setter, mais também pode ser injetado com Construtor.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Através da Injeção de Dependência, facilitará em ligar a camada de persistência de dados&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;com a camada de negócio e consequentemente com a camada de controller, deixando ambas as camadas&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;desacopladas entre si.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Além da DI que o Spring ofere, iremos usar o JDBCTemplate para manipular os dados da camada de&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;persistência, este template possui vários métodos utilitários para trabalhar com JDBC, e o mesmo&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;já fica encarregado de abrir/fechar conexão, statement e result, apenas vamos precisar de um&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Data Source para trabalhar com as querys.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;A camada de controller e apresentação, será feita com Servlet/JSP, mostrando assim, como o Spring&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;é bem modular e que integra facilmente nossas camadas.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Para o exemplo será usado o Eclipse Indigo, TomCat 6,&amp;nbsp;Banco de Dados Derby&amp;nbsp;e o Spring 2.5.6, &amp;nbsp;para baixar o framework,&amp;nbsp;acesse: http://www.springsource.org/download, baixe a versão full, com todos as dependências.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Ao final do post, o projeto está disponível para download, com todas as libs necessárias.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Segue o modelo da estrutura do projeto:
&lt;/span&gt;&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZWf6ZOAMsQGFimLtzKUfxNMavCBrYCbGuUbIx8JfnssNnJvzOsVYTgkfkDATBNPVJWw45DTrv7T2KiEC9DdBEbP7XsRSd07ZncLsOOH51lbABz2X9xxQkF8xfoT2mJZSzt4S0BPW92fEi/s1600/1.png&quot; imageanchor=&quot;1&quot; rel=&quot;lightbox&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;238&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZWf6ZOAMsQGFimLtzKUfxNMavCBrYCbGuUbIx8JfnssNnJvzOsVYTgkfkDATBNPVJWw45DTrv7T2KiEC9DdBEbP7XsRSd07ZncLsOOH51lbABz2X9xxQkF8xfoT2mJZSzt4S0BPW92fEi/s320/1.png&quot; width=&quot;320&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;1. Passo: Vamos criar nossa classe modelo, que se chamará Pessoa:&lt;/span&gt;&lt;br /&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZMsOwBodk2Mae0GQ4afj30Q7d-cg0YAqbEWWBaeIgckYg1XaoNhDwInNMKUYSpOH9hbwS-Mfo-vV5zSWn-kVeezcp7R3jqZ84vtaFTMqicbzSUOvU4mzNl9IbbbYtTzkXkiFBi2xBvIlz/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; package model;  
 public class Pessoa {  
      private int id;  
      private String nome;  
      public Pessoa() {  
           super();  
      }  
      public Pessoa(String nome) {  
           super();            
           this.nome = nome;  
      }  
      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;  
      }  
      @Override  
      public String toString() {  
           return &quot;Pessoa [id=&quot; + id + &quot;, nome=&quot; + nome + &quot;]&quot;;  
      }  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Pessoa.java&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;2. Passo: Agora vamos criar a Interface DAO.&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZMsOwBodk2Mae0GQ4afj30Q7d-cg0YAqbEWWBaeIgckYg1XaoNhDwInNMKUYSpOH9hbwS-Mfo-vV5zSWn-kVeezcp7R3jqZ84vtaFTMqicbzSUOvU4mzNl9IbbbYtTzkXkiFBi2xBvIlz/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; package dao;  
 import java.util.List;  
 import model.Pessoa;  
 public interface PessoaDAO {  
      void insert(Pessoa pessoa);  
      List&amp;lt;Pessoa&amp;gt; select();   
      void delete(int id);  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;PessoaDAO.java&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;3. Passo: Nesta classe, vamos implementar os métodos de contrato da Interface, além disto, teremos um método que será responsável por criar a tabela PESSOA, no banco de dados Derby, (as configurações do banco, data source, etc..., será explicada daqui alguns instantes.). Deve-se ressaltar, que o atributo jdbcTemplate do tipo&amp;nbsp;JdbcTemplate, é responsável por manipular os dados nessa camada de persistência, observe-se que não instanciamos o objeto com new, apenas teremos que ter o método setter deste atributo, para que o container do Spring, posso se encarregar de fazer a injeção de dependência.&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZMsOwBodk2Mae0GQ4afj30Q7d-cg0YAqbEWWBaeIgckYg1XaoNhDwInNMKUYSpOH9hbwS-Mfo-vV5zSWn-kVeezcp7R3jqZ84vtaFTMqicbzSUOvU4mzNl9IbbbYtTzkXkiFBi2xBvIlz/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; package dao;  
 import java.util.ArrayList;  
 import java.util.List;  
 import java.util.Map;  
 import model.Pessoa;  
 import org.springframework.dao.DataAccessException;  
 import org.springframework.jdbc.core.JdbcTemplate;  
 public class PessoaDAOImp implements PessoaDAO {  
      private JdbcTemplate jdbcTemplate;  
      @SuppressWarnings(&quot;unused&quot;)  
      private void init() {  
           StringBuilder sb = new StringBuilder();  
           sb.append(&quot;CREATE TABLE pessoa (&quot;);  
           sb.append(&quot;id INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (&quot;);  
           sb.append(&quot;START WITH 1, INCREMENT BY 1),&quot;);  
           sb.append(&quot; nome VARCHAR(50),&quot;);  
           sb.append(&quot; CONSTRAINT primary_key PRIMARY KEY (id))&quot;);  
           try {  
                jdbcTemplate.execute(sb.toString());  
                insert(new Pessoa(&quot;Jabes Felipe&quot;));  
           } catch (DataAccessException e) {                 
 //               jdbcTemplate.execute(&quot;drop table autor &quot;);  
                e.printStackTrace();  
           }  
      }  
      @Override  
      public void insert(Pessoa pessoa) {  
           jdbcTemplate.update(&quot;INSERT INTO pessoa (nome) VALUES (?) &quot;, new Object[]{pessoa.getNome()});  
      }  
      @SuppressWarnings(&quot;unchecked&quot;)  
      @Override  
      public List&amp;lt;Pessoa&amp;gt; select() {                      
           List&amp;lt;Map&amp;lt;String, Object&amp;gt;&amp;gt; list = jdbcTemplate.queryForList(&quot;SELECT id, nome FROM pessoa&quot;);  
           List&amp;lt;Pessoa&amp;gt; pessoas = new ArrayList&amp;lt;Pessoa&amp;gt;(list.size());  
           for (Map&amp;lt;String, Object&amp;gt; map : list) {                 
                Pessoa pessoa = new Pessoa();  
                pessoa.setId(Integer.parseInt(map.get(&quot;ID&quot;).toString()));  
                pessoa.setNome(map.get(&quot;NOME&quot;).toString());  
                pessoas.add(pessoa);  
           }  
           return pessoas;  
      }  
      @Override  
      public void delete(int id) {  
           jdbcTemplate.update(&quot;DELETE FROM pessoa WHERE id=?&quot;, new Object[]{id});            
      }  
      public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {  
           this.jdbcTemplate = jdbcTemplate;  
      }       
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;PessoaDAOImp.java&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;4. Passo: Vamos criar a camada de serviço, definimos a Interface.&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZMsOwBodk2Mae0GQ4afj30Q7d-cg0YAqbEWWBaeIgckYg1XaoNhDwInNMKUYSpOH9hbwS-Mfo-vV5zSWn-kVeezcp7R3jqZ84vtaFTMqicbzSUOvU4mzNl9IbbbYtTzkXkiFBi2xBvIlz/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; package service;  
 import java.util.List;  
 import model.Pessoa;  
 public interface PessoaService {  
      void insert(Pessoa pessoa);  
      List&amp;lt;Pessoa&amp;gt; select();  
      void delete(int id);  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;PessoaService.java&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;5. Passo: Classe que implementa a Interface de serviço, vale apena ressaltar, que a referência&amp;nbsp;PessoaDAO que um atributo&amp;nbsp;pessoaDAO, será injetado pelo Spring através do método Setter que criamos.&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZMsOwBodk2Mae0GQ4afj30Q7d-cg0YAqbEWWBaeIgckYg1XaoNhDwInNMKUYSpOH9hbwS-Mfo-vV5zSWn-kVeezcp7R3jqZ84vtaFTMqicbzSUOvU4mzNl9IbbbYtTzkXkiFBi2xBvIlz/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; package service;  
 import java.util.List;  
 import model.Pessoa;  
 import dao.PessoaDAO;  
 public class PessoaServiceImp implements PessoaService {  
      private PessoaDAO pessoaDAO;  
      @Override  
      public void insert(Pessoa pessoa) {  
           pessoaDAO.insert(pessoa);  
      }  
      @Override  
      public List&amp;lt;Pessoa&amp;gt; select() {  
           return pessoaDAO.select();  
      }  
      @Override  
      public void delete(int id) {  
           pessoaDAO.delete(id);            
      }  
      public void setPessoaDAO(PessoaDAO pessoaDAO) {  
           this.pessoaDAO = pessoaDAO;  
      }  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;PessoaServiceImp.java&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;6. Passo: Já criamos nossa camada de persistência e de serviço, agora vamos criar um Servlet que será nosso controller da camada de tela e serviço.&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZMsOwBodk2Mae0GQ4afj30Q7d-cg0YAqbEWWBaeIgckYg1XaoNhDwInNMKUYSpOH9hbwS-Mfo-vV5zSWn-kVeezcp7R3jqZ84vtaFTMqicbzSUOvU4mzNl9IbbbYtTzkXkiFBi2xBvIlz/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; package servlets;  
 import java.io.IOException;  
 import javax.servlet.ServletException;  
 import javax.servlet.http.HttpServlet;  
 import javax.servlet.http.HttpServletRequest;  
 import javax.servlet.http.HttpServletResponse;  
 import model.Pessoa;  
 import org.springframework.beans.factory.annotation.Autowired;  
 import org.springframework.web.context.support.SpringBeanAutowiringSupport;  
 import service.PessoaService;  
 import service.PessoaServiceImp;  
 public class PessoaServlet extends HttpServlet {  
      private static final long serialVersionUID = 1L;  
      @Autowired   
      private PessoaService pessoaService;  
      protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {  
           SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);  
           String acao = request.getParameter(&quot;acao&quot;);  
           if (&quot;salvar&quot;.equals(acao)) {  
                Pessoa pessoa = new Pessoa();  
                pessoa.setNome(request.getParameter(&quot;nome&quot;));  
                pessoaService.insert(pessoa);  
           } else if (&quot;excluir&quot;.equals(acao)) {  
                int id = Integer.parseInt(request.getParameter(&quot;id&quot;));  
                pessoaService.delete(id);  
           }  
           request.setAttribute(&quot;pessoas&quot;, pessoaService.select());  
           getServletConfig().getServletContext().getRequestDispatcher(&quot;/home.jsp&quot;).forward(request,response);  
      }  
      public void setAutorService(PessoaServiceImp pessoaService) {  
           this.pessoaService = pessoaService;  
      }  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;PessoaServlet.java&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;7. Passo: Agora vamos configurar as definições necessárias do Spring no arquivo web.xml.&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZMsOwBodk2Mae0GQ4afj30Q7d-cg0YAqbEWWBaeIgckYg1XaoNhDwInNMKUYSpOH9hbwS-Mfo-vV5zSWn-kVeezcp7R3jqZ84vtaFTMqicbzSUOvU4mzNl9IbbbYtTzkXkiFBi2xBvIlz/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; &amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;  
 &amp;lt;web-app xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot; xmlns:web=&quot;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot; xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot; id=&quot;WebApp_ID&quot; version=&quot;2.5&quot;&amp;gt;  
  &amp;lt;display-name&amp;gt;Spring&amp;lt;/display-name&amp;gt;  
  &amp;lt;welcome-file-list&amp;gt;    
   &amp;lt;welcome-file&amp;gt;index.jsp&amp;lt;/welcome-file&amp;gt;    
  &amp;lt;/welcome-file-list&amp;gt;  
  &amp;lt;!-- Define os arquivos de configuracoes XML para o contexto Spring --&amp;gt;  
  &amp;lt;context-param&amp;gt;  
   &amp;lt;param-name&amp;gt;contextConfigLocation&amp;lt;/param-name&amp;gt;  
   &amp;lt;param-value&amp;gt;/WEB-INF/applicationContext.xml&amp;lt;/param-value&amp;gt;  
  &amp;lt;/context-param&amp;gt;  
  &amp;lt;!-- Inicializa o Spring Web Application Context --&amp;gt;  
  &amp;lt;listener&amp;gt;  
   &amp;lt;listener-class&amp;gt;org.springframework.web.context.ContextLoaderListener&amp;lt;/listener-class&amp;gt;  
  &amp;lt;/listener&amp;gt;  
  &amp;lt;!-- Ativa os escopos web para os beans no Spring --&amp;gt;  
  &amp;lt;listener&amp;gt;  
   &amp;lt;listener-class&amp;gt;org.springframework.web.context.request.RequestContextListener&amp;lt;/listener-class&amp;gt;  
  &amp;lt;/listener&amp;gt;  
  &amp;lt;servlet&amp;gt;  
   &amp;lt;description&amp;gt;&amp;lt;/description&amp;gt;  
   &amp;lt;display-name&amp;gt;PessoaServlet&amp;lt;/display-name&amp;gt;  
   &amp;lt;servlet-name&amp;gt;PessoaServlet&amp;lt;/servlet-name&amp;gt;  
   &amp;lt;servlet-class&amp;gt;servlets.PessoaServlet&amp;lt;/servlet-class&amp;gt;  
  &amp;lt;/servlet&amp;gt;  
  &amp;lt;servlet-mapping&amp;gt;  
   &amp;lt;servlet-name&amp;gt;PessoaServlet&amp;lt;/servlet-name&amp;gt;  
   &amp;lt;url-pattern&amp;gt;/PessoaServlet&amp;lt;/url-pattern&amp;gt;  
  &amp;lt;/servlet-mapping&amp;gt;  
 &amp;lt;/web-app&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;web.xml&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;8. Passo: Agora chegou, a parte mais importante, que é o arquivo de configuração dos beans, contexto e datasource do Spring. Neste arquivo está configurado o Data Source que contém as informações do banco, o jdbcTemplate que contém uma referência ao dataSource, também configuramos os properties do banco e por fim, temos a definição de pessoaDAO e pessoaService.&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZMsOwBodk2Mae0GQ4afj30Q7d-cg0YAqbEWWBaeIgckYg1XaoNhDwInNMKUYSpOH9hbwS-Mfo-vV5zSWn-kVeezcp7R3jqZ84vtaFTMqicbzSUOvU4mzNl9IbbbYtTzkXkiFBi2xBvIlz/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; &amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;  
 &amp;lt;!--  
  - Application context definition for JPetStore&#39;s business layer.  
  - Contains bean references to the transaction manager and to the DAOs in  
  - dataAccessContext-local/jta.xml (see web.xml&#39;s &quot;contextConfigLocation&quot;).  
  --&amp;gt;  
 &amp;lt;beans xmlns=&quot;http://www.springframework.org/schema/beans&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;  
           xmlns:p=&quot;http://www.springframework.org/schema/p&quot; xmlns:aop=&quot;http://www.springframework.org/schema/aop&quot;  
           xmlns:context=&quot;http://www.springframework.org/schema/context&quot; xmlns:jee=&quot;http://www.springframework.org/schema/jee&quot;  
           xmlns:tx=&quot;http://www.springframework.org/schema/tx&quot;  
           xsi:schemaLocation=&quot;  
                http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd  
                http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd  
                http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd  
                http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd  
                http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd&quot;&amp;gt;  
      &amp;lt;bean id=&quot;pessoaService&quot; class=&quot;service.PessoaServiceImp&quot; lazy-init=&quot;false&quot; scope=&quot;singleton&quot;&amp;gt;  
           &amp;lt;property name=&quot;pessoaDAO&quot; ref=&quot;pessoaDAO&quot; /&amp;gt;  
      &amp;lt;/bean&amp;gt;  
      &amp;lt;bean id=&quot;pessoaDAO&quot; class=&quot;dao.PessoaDAOImp&quot; init-method=&quot;init&quot; lazy-init=&quot;false&quot; scope=&quot;singleton&quot;&amp;gt;  
           &amp;lt;property name=&quot;jdbcTemplate&quot; ref=&quot;jdbcTemplate&quot; /&amp;gt;  
      &amp;lt;/bean&amp;gt;  
      &amp;lt;!-- arquivo properties --&amp;gt;  
      &amp;lt;context:property-placeholder location=&quot;classpath:resources/jdbc.properties&quot; /&amp;gt;  
      &amp;lt;!-- Config. datasource --&amp;gt;  
      &amp;lt;bean id=&quot;dataSource&quot;   
            class=&quot;org.apache.commons.dbcp.BasicDataSource&quot;   
            destroy-method=&quot;close&quot;  
            p:driverClassName=&quot;${jdbc.driverClassName}&quot;   
            p:url=&quot;${jdbc.url}&quot;   
            p:username=&quot;${jdbc.username}&quot;  
            p:password=&quot;${jdbc.password}&quot; /&amp;gt;  
      &amp;lt;!-- Transaction manager for a single JDBC DataSource (alternative to JTA) --&amp;gt;  
      &amp;lt;bean id=&quot;transactionManager&quot;   
         class=&quot;org.springframework.jdbc.datasource.DataSourceTransactionManager&quot;  
            p:dataSource-ref=&quot;dataSource&quot;/&amp;gt;  
      &amp;lt;!-- JDBC template --&amp;gt;  
      &amp;lt;bean  
           id=&quot;jdbcTemplate&quot;  
           class=&quot;org.springframework.jdbc.core.JdbcTemplate&quot;  
           lazy-init=&quot;false&quot;&amp;gt;  
                &amp;lt;property name=&quot;dataSource&quot; ref=&quot;dataSource&quot; /&amp;gt;  
                &amp;lt;property name=&quot;lazyInit&quot; value=&quot;false&quot; /&amp;gt;  
      &amp;lt;/bean&amp;gt;  
 &amp;lt;/beans&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;applicationContext.xml&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;9. Passo: Segue informações do banco de dados Derby, que estão contidas em um arquivo de properties.&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZMsOwBodk2Mae0GQ4afj30Q7d-cg0YAqbEWWBaeIgckYg1XaoNhDwInNMKUYSpOH9hbwS-Mfo-vV5zSWn-kVeezcp7R3jqZ84vtaFTMqicbzSUOvU4mzNl9IbbbYtTzkXkiFBi2xBvIlz/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; # Properties file with JDBC settings.  
 #  
 # Applied by &amp;lt;context:property-placeholder location=&quot;jdbc.properties&quot;/&amp;gt; from  
 # various application context XML files (e.g., &quot;applicationContext-*.xml&quot;).  
 # Targeted at system administrators, to avoid touching the context XML files.  
 #-------------------------------------------------------------------------------  
 jdbc.driverClassName=org.apache.derby.jdbc.EmbeddedDriver  
 jdbc.hostname=localhost  
 jdbc.database=spring  
 jdbc.username=spring  
 jdbc.password=spring  
 jdbc.port=3306  
 jdbc.url=jdbc\:derby\:directory\:${jdbc.database}ExemploDB;create\=true  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;10. Passo: Segue as telas jsp.&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZMsOwBodk2Mae0GQ4afj30Q7d-cg0YAqbEWWBaeIgckYg1XaoNhDwInNMKUYSpOH9hbwS-Mfo-vV5zSWn-kVeezcp7R3jqZ84vtaFTMqicbzSUOvU4mzNl9IbbbYtTzkXkiFBi2xBvIlz/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; &amp;lt;% response.sendRedirect(&quot;./PessoaServlet&quot;); %&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;index.jsp&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;pre style=&quot;background-image: URL(https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZMsOwBodk2Mae0GQ4afj30Q7d-cg0YAqbEWWBaeIgckYg1XaoNhDwInNMKUYSpOH9hbwS-Mfo-vV5zSWn-kVeezcp7R3jqZ84vtaFTMqicbzSUOvU4mzNl9IbbbYtTzkXkiFBi2xBvIlz/s320/codebg.gif); background: #f0f0f0; border: 1px dashed #CCCCCC; color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; &amp;lt;%@taglib prefix=&quot;c&quot; uri=&quot;http://java.sun.com/jsp/jstl/core&quot;%&amp;gt;  
 &amp;lt;%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=ISO-8859-1&quot;  
      pageEncoding=&quot;ISO-8859-1&quot;%&amp;gt;  
 &amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&amp;gt;  
 &amp;lt;html&amp;gt;  
 &amp;lt;head&amp;gt;  
 &amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=ISO-8859-1&quot;&amp;gt;  
 &amp;lt;title&amp;gt;SPRING&amp;lt;/title&amp;gt;  
 &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;  
 function validar() {  
      var nome = document.getElementById(&quot;nome&quot;);  
      if (nome == null || nome.value == &#39;&#39;) {  
           alert(&quot;Nome obrigatorio!&quot;);   
           return false;            
      } else {            
            return true;  
      }  
 }  
 &amp;lt;/script&amp;gt;  
 &amp;lt;/head&amp;gt;  
 &amp;lt;body&amp;gt;  
      &amp;lt;form action=&quot;./PessoaServlet&quot; method=&quot;get&quot; onsubmit=&quot;return validar();&quot;&amp;gt;  
           &amp;lt;table&amp;gt;  
                &amp;lt;tr&amp;gt;  
                     &amp;lt;td&amp;gt;Nome:&amp;lt;/td&amp;gt;  
                     &amp;lt;td&amp;gt;&amp;lt;input id=&quot;nome&quot; name=&quot;nome&quot; type=&quot;text&quot;&amp;gt;&amp;lt;/td&amp;gt;  
                &amp;lt;/tr&amp;gt;  
                &amp;lt;tr&amp;gt;  
                     &amp;lt;td colspan=&quot;2&quot;&amp;gt;&amp;lt;input name=&quot;acao&quot; type=&quot;hidden&quot; value=&quot;salvar&quot; /&amp;gt;  
                          &amp;lt;input type=&quot;submit&quot; value=&quot;salvar&quot; /&amp;gt;  
                     &amp;lt;/td&amp;gt;  
                &amp;lt;/tr&amp;gt;  
           &amp;lt;/table&amp;gt;  
           &amp;lt;br /&amp;gt;  
           &amp;lt;table&amp;gt;  
                &amp;lt;tr&amp;gt;  
                     &amp;lt;td&amp;gt;ID&amp;lt;/td&amp;gt;  
                     &amp;lt;td&amp;gt;Nome&amp;lt;/td&amp;gt;  
                     &amp;lt;td&amp;gt;Excluir&amp;lt;/td&amp;gt;  
                &amp;lt;/tr&amp;gt;  
                &amp;lt;c:forEach var=&quot;pessoa&quot; items=&quot;${pessoas}&quot;&amp;gt;  
                     &amp;lt;tr&amp;gt;  
                          &amp;lt;td&amp;gt;&amp;lt;c:out value=&quot;${pessoa.id}&quot; /&amp;gt;&amp;lt;/td&amp;gt;  
                          &amp;lt;td&amp;gt;&amp;lt;c:out value=&quot;${pessoa.nome}&quot; /&amp;gt;&amp;lt;/td&amp;gt;  
                          &amp;lt;td&amp;gt;&amp;lt;a href=&quot;./PessoaServlet?acao=excluir&amp;amp;id=${pessoa.id}&quot;&amp;gt;Excluir&amp;lt;/a&amp;gt;  
                          &amp;lt;/td&amp;gt;  
                     &amp;lt;/tr&amp;gt;  
                &amp;lt;/c:forEach&amp;gt;  
           &amp;lt;/table&amp;gt;  
      &amp;lt;/form&amp;gt;  
 &amp;lt;/body&amp;gt;  
 &amp;lt;/html&amp;gt;  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;home.jsp&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Exemplo da tela:&lt;/span&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: justify;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4hAC3VH0x2UFnA2HLQLGboLwU0eBRG-10ipoD6zFNOf5MbFdJMz6nUhCBZd7cV3pfI0wap26qwEkIH4E_qKeA1kxNMihJpinNASLjRsE68JaLQ66Wfp0ppKHkb3Prgayff5n8WNpthkiO/s1600/2.png&quot; imageanchor=&quot;1&quot; rel=&quot;lightbox&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4hAC3VH0x2UFnA2HLQLGboLwU0eBRG-10ipoD6zFNOf5MbFdJMz6nUhCBZd7cV3pfI0wap26qwEkIH4E_qKeA1kxNMihJpinNASLjRsE68JaLQ66Wfp0ppKHkb3Prgayff5n8WNpthkiO/s1600/2.png&quot; /&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #4f4f4f; font-size: 14px; line-height: 20px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Para quem quiser baixar o projeto desenvolvido,&amp;nbsp;&lt;a href=&quot;http://www.4shared.com/file/j0EcBoMA/Exemplo_Spring.html?&quot;&gt;clique aqui&lt;/a&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #4f4f4f; font-size: 14px; line-height: 20px;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: inherit;&quot;&gt;Qualquer dúvida, crítica ou sugestão, fico à disposição.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/3337998946513833558/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2011/10/exemplo-spring.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/3337998946513833558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/3337998946513833558'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2011/10/exemplo-spring.html' title='Exemplo CRUD Spring com JDBC Template e Servlet/JSP'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZWf6ZOAMsQGFimLtzKUfxNMavCBrYCbGuUbIx8JfnssNnJvzOsVYTgkfkDATBNPVJWw45DTrv7T2KiEC9DdBEbP7XsRSd07ZncLsOOH51lbABz2X9xxQkF8xfoT2mJZSzt4S0BPW92fEi/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-2471281015857833880</id><published>2011-08-26T07:17:00.000-07:00</published><updated>2011-08-26T17:00:07.829-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Google"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Enviar e-mail com anexo em Java usando o gmail.</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Depois de um longo periodo sem postar, neste post, vou mostrar como mandar email com anexo em java, e para testar o nosso envio de email, vamos usar o gmail. Neste exemplo será usado a API javax.mail, teremos apenas uma classe que irá mandar uma imagem em anexo usando o protocolo do gmail.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;No final do post, o projeto estará disponível para download.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;package com.blogspot.jabesfelipe.email;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;import java.io.InputStream;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;import java.util.Properties;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;import javax.activation.DataHandler;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;import javax.mail.Authenticator;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;import javax.mail.Message;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;import javax.mail.Multipart;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;import javax.mail.PasswordAuthentication;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;import javax.mail.Session;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;import javax.mail.Transport;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;import javax.mail.internet.InternetAddress;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;import javax.mail.internet.MimeBodyPart;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;import javax.mail.internet.MimeMessage;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;import javax.mail.internet.MimeMultipart;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;import javax.mail.util.ByteArrayDataSource;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;/**&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt; * Classe para enviar email em anexo usando o Gmail.&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt; * &lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt; * @author jabes.cunha&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt; *&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt; */&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;public class EnviaEmail {&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot; &gt;	&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;public static void main(String[] args) {&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;new EnviaEmail().enviar();&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;public void enviar() {&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;try {&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;		&lt;/span&gt;//usuario e senha do seu gmail&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;final String usuario = &quot;jabesfelipe@gmail.com&quot;;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;final String senha = &quot;mandioca&quot;;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;//config. do gmail&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;Properties mailProps = new Properties();&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/span&gt;mailProps.put(&quot;mail.transport.protocol&quot;, &quot;smtp&quot;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;	&lt;/span&gt;mailProps.put(&quot;mail.smtp.starttls.enable&quot;,&quot;true&quot;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;		&lt;/span&gt;mailProps.put(&quot;mail.smtp.host&quot;, &quot;smtp.gmail.com&quot;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;		&lt;/span&gt;mailProps.put(&quot;mail.smtp.auth&quot;, &quot;true&quot;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;	&lt;/span&gt;mailProps.put(&quot;mail.smtp.user&quot;, usuario);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;	&lt;/span&gt;        &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;mailProps.put(&quot;mail.debug&quot;, &quot;true&quot;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;/span&gt;mailProps.put(&quot;mail.smtp.port&quot;, &quot;465&quot;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;		&lt;/span&gt;mailProps.put(&quot;mail.smtp.socketFactory.port&quot;, &quot;465&quot;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/span&gt;mailProps.put(&quot;mail.smtp.socketFactory.class&quot;, &quot;javax.net.ssl.SSLSocketFactory&quot;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;		&lt;/span&gt;mailProps.put(&quot;mail.smtp.socketFactory.fallback&quot;, &quot;false&quot;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;		&lt;/span&gt;//eh necessario autenticar&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;Session mailSession = Session.getInstance(mailProps, new Authenticator() {&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;public PasswordAuthentication getPasswordAuthentication(){&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;					&lt;/span&gt;return new PasswordAuthentication(usuario, senha);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;				&lt;/span&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;});&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;mailSession.setDebug(false);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;//config. da mensagem &lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;Message mailMessage = new MimeMessage(mailSession);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;//remetente&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;mailMessage.setFrom(new InternetAddress(usuario));&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;//destinatario&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;mailMessage.setRecipients(Message.RecipientType.TO, &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;InternetAddress.parse(usuario));&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;//mensagem que vai no corpo do email&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;MimeBodyPart mbpMensagem = new MimeBodyPart();&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;mbpMensagem.setText(&quot;Segue em anexo, imagem do novo focus hath.&quot;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;//partes do email&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;Multipart mp = new MimeMultipart();&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;mp.addBodyPart(mbpMensagem);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot; &gt;			&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;//imagem que sera enviada em anexo, ta no mesmo diretorio da classe.&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;String imagem = &quot;focusHath2011.jpg&quot;;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;InputStream is = getClass().getResourceAsStream(imagem);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;//setando o anexo&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;MimeBodyPart mbpAnexo = new MimeBodyPart();&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;mbpAnexo.setDataHandler(new DataHandler(new ByteArrayDataSource(is, &quot;application/image&quot;)));&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;mbpAnexo.setFileName(imagem);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;mp.addBodyPart(mbpAnexo);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;//assunto do email&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;mailMessage.setSubject(&quot;Novo Focus Hath 2011&quot;);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot; &gt;			&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;//seleciona o conteudo&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;mailMessage.setContent(mp);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;br /&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;//envia o email&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;Transport.send(mailMessage);&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;} catch (Exception e) {&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;e.printStackTrace();&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;}&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;EnviaEmail.java&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;A classe, está documentada, explicando os passos a passos, o e-mail que será enviado, ficará conforme imagem abaixo:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpMPcOdwWQcfWOBBsHc4iE6jFGFXXOnQML4niSNudvztitFXIwwEDGVwAvfDcacmV-WlayoYyP8fnTccagGsxfz8M4nzkylynQBF7KM_i7SvbqCJ05TiGbKLq0lDeKJi0wp5nA8JxqSxaI/s1600/email.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpMPcOdwWQcfWOBBsHc4iE6jFGFXXOnQML4niSNudvztitFXIwwEDGVwAvfDcacmV-WlayoYyP8fnTccagGsxfz8M4nzkylynQBF7KM_i7SvbqCJ05TiGbKLq0lDeKJi0wp5nA8JxqSxaI/s400/email.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5645316015792621570&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 276px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Para quem quiser baixar o projeto desenvolvido, &lt;a href=&quot;http://www.4shared.com/file/VBvdXSab/Enviar_e-mail_com_anexo_em_Jav.html?&quot;&gt;clique aqui&lt;/a&gt;.&lt;br /&gt;Qualque dúvida, crítica ou sugestão, fico à disposição.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/2471281015857833880/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2011/08/enviar-e-mail-com-anexo-em-java-usando.html#comment-form' title='10 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/2471281015857833880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/2471281015857833880'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2011/08/enviar-e-mail-com-anexo-em-java-usando.html' title='Enviar e-mail com anexo em Java usando o gmail.'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpMPcOdwWQcfWOBBsHc4iE6jFGFXXOnQML4niSNudvztitFXIwwEDGVwAvfDcacmV-WlayoYyP8fnTccagGsxfz8M4nzkylynQBF7KM_i7SvbqCJ05TiGbKLq0lDeKJi0wp5nA8JxqSxaI/s72-c/email.png" height="72" width="72"/><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-5633152675357305058</id><published>2011-05-15T10:26:00.000-07:00</published><updated>2011-05-15T10:26:00.477-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="EJB"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="JBoss"/><category scheme="http://www.blogger.com/atom/ns#" term="JSP e Servlet"/><title type='text'>Utilizando EJB2 com Client Servlet e Swing (Parte 2)</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Continuando nosso projeto em EJB2, neste post, vamos criar dois tipos de Client, o primeiro será um projeto web, que vai usar Servlet, o segundo será uma aplicação em Swing, ambos os projetos irão acessar nosso EJB2 por meio do recurso de JNDI.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Uma das grandes vantagens do EJB, é o reuso do código, assim, nossa camada de negócio, poderá ser usada, em diversos tipo de Client.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Ao final deste post, deixarei o projeto completo para download.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. Passo: Vamos criar um projeto web chamado ExemploEJB-web, nesse projeto, crie um Servlet chamado HelloServlet, lembrando que é necessário adicionar o projeto ExemploEJB2 em Project References, e não esqueça de adionar este projeto  como módulo Web no arquivo application.xml que está no projeto EAR.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;package com.blogpost.jabesfelipe.servlets;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import java.io.IOException;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import java.io.PrintWriter;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.ejb.CreateException;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.naming.Context;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.naming.InitialContext;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.naming.NamingException;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.rmi.PortableRemoteObject;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.servlet.ServletException;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.servlet.http.HttpServlet;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.servlet.http.HttpServletRequest;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.servlet.http.HttpServletResponse;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import com.blogpost.jabesfelipe.service.Hello;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import com.blogpost.jabesfelipe.service.HelloHome;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;public class HelloServlet extends HttpServlet {&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;protected void doGet(HttpServletRequest request,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;HttpServletResponse response) throws ServletException, IOException {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;try {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;Context initial = new InitialContext();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;Object objref = initial.lookup(&quot;HelloBean&quot;);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;HelloHome home = (HelloHome) PortableRemoteObject.narrow(objref,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;     &lt;/span&gt;HelloHome.class);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;Hello remote = home.create();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;PrintWriter out = response.getWriter();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;out.println(remote.showName(&quot;Jabes Felipe&quot;));&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;} catch (NamingException e) {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;e.printStackTrace();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;} catch (CreateException e) {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;e.printStackTrace();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;}&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;HelloServlet.java&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para poder testar nossa aplicação, digite a seguinte URL &lt;a href=&quot;http://localhost:8080/ExemploEJB2-web/HelloServlet&quot;&gt;http://localhost:8080/ExemploEJB2-web/HelloServlet&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9IefHmDyOM4m8YHNrpRz3K4v24_CvIVxi-qGaXCJ2lFGYDNcoNSTt47m6HPmCfE4-KjbwgeA9mCOKzER8Ol9-Zq-Xaq-xxTpMgaMEfu9TwzVLFmytfR1dEAmd796B9FJ8kAN6Gy4prldK/s400/2.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9IefHmDyOM4m8YHNrpRz3K4v24_CvIVxi-qGaXCJ2lFGYDNcoNSTt47m6HPmCfE4-KjbwgeA9mCOKzER8Ol9-Zq-Xaq-xxTpMgaMEfu9TwzVLFmytfR1dEAmd796B9FJ8kAN6Gy4prldK/s400/2.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5596608923213849490&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 117px; &quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2. Passo: Vamos agora, criar um projeto java, chamado ExemploEJB2-swing, crie uma classe HelloSwing, nessa classe, temos um simples JFrame, composto por um campo Texto e Botão, na ação deste botão, vamos chamar nosso método no EJB e ele retornará um valor em String em um componente JOptionPane.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Lembrando que é necessário adicionar o projeto ExemploEJB2 em Project References.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;package com.blogpost.jabesfelipe.swing;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import java.rmi.RemoteException;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import java.util.Properties;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.ejb.CreateException;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.naming.Context;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.naming.InitialContext;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.naming.NamingException;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.rmi.PortableRemoteObject;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.swing.JButton;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.swing.JFrame;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.swing.JLabel;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.swing.JOptionPane;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.swing.JTextField;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import com.blogpost.jabesfelipe.service.Hello;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import com.blogpost.jabesfelipe.service.HelloHome;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;public class HelloSwing extends JFrame {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public HelloSwing() {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;initComponents();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public static void main(String[] args) {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;java.awt.EventQueue.invokeLater(new Runnable() {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;public void run() {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;new HelloSwing().setVisible(true);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;});&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;private void initService() {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;try {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;Properties t = new Properties();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;t.put(Context.INITIAL_CONTEXT_FACTORY,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;     &lt;/span&gt;&quot;org.jnp.interfaces.NamingContextFactory&quot;);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;t.put(Context.PROVIDER_URL, &quot;jnp://localhost:1099&quot;);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;Context context = new InitialContext(t);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;Object objref = context.lookup(&quot;HelloBean&quot;);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;HelloHome home = (HelloHome) PortableRemoteObject.narrow(objref,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;     &lt;/span&gt;HelloHome.class);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;Hello remote = home.create();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;JOptionPane.showMessageDialog(null,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;     &lt;/span&gt;remote.showName(jTxtFldName.getText().toString()));&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;} catch (NamingException e) {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;e.printStackTrace();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;} catch (CreateException e) {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;e.printStackTrace();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;} catch (RemoteException e) {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;e.printStackTrace();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;private void jBtOKActionPerformed(java.awt.event.ActionEvent evt) {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;initService();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;private void initComponents() {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;jLblName = new javax.swing.JLabel();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;jTxtFldName = new javax.swing.JTextField();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;jBtOK = new javax.swing.JButton();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;jLblTitle = new javax.swing.JLabel();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;jLblName.setText(&quot;Informe seu Nome: &quot;);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;jBtOK.setText(&quot;OK&quot;);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;jBtOK.addActionListener(new java.awt.event.ActionListener() {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;public void actionPerformed(java.awt.event.ActionEvent evt) {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;jBtOKActionPerformed(evt);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;});&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;jLblTitle.setFont(new java.awt.Font(&quot;Courier 10 Pitch&quot;, 1, 18)); // NOI18N&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;jLblTitle.setText(&quot;Exemplo - Chamando Serviço EJB2 em Swing&quot;);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;javax.swing.GroupLayout layout = new javax.swing.GroupLayout(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;getContentPane());&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;getContentPane().setLayout(layout);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;layout.setHorizontalGroup(layout&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;.addGroup(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;      &lt;/span&gt;layout.createSequentialGroup()&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;        &lt;/span&gt;.addGroup(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;          &lt;/span&gt;layout.createParallelGroup(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;            &lt;/span&gt;javax.swing.GroupLayout.Alignment.LEADING)&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;            &lt;/span&gt;.addGroup(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;              &lt;/span&gt;layout.createSequentialGroup()&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                &lt;/span&gt;.addGap(25, 25,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                  &lt;/span&gt;25)&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                &lt;/span&gt;.addComponent(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                  &lt;/span&gt;jLblName)&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                &lt;/span&gt;.addGap(1, 1, 1)&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                &lt;/span&gt;.addComponent(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                  &lt;/span&gt;jTxtFldName,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                  &lt;/span&gt;javax.swing.GroupLayout.PREFERRED_SIZE,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                  &lt;/span&gt;153,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                  &lt;/span&gt;javax.swing.GroupLayout.PREFERRED_SIZE)&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                &lt;/span&gt;.addPreferredGap(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                  &lt;/span&gt;javax.swing.LayoutStyle.ComponentPlacement.RELATED)&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                &lt;/span&gt;.addComponent(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                  &lt;/span&gt;jBtOK))&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;            &lt;/span&gt;.addGroup(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;              &lt;/span&gt;layout.createSequentialGroup()&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                &lt;/span&gt;.addContainerGap()&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                &lt;/span&gt;.addComponent(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;                  &lt;/span&gt;jLblTitle)))&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;        &lt;/span&gt;.addContainerGap(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;          &lt;/span&gt;javax.swing.GroupLayout.DEFAULT_SIZE,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;          &lt;/span&gt;Short.MAX_VALUE)));&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;layout.setVerticalGroup(layout&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;.addGroup(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;      &lt;/span&gt;javax.swing.GroupLayout.Alignment.TRAILING,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;      &lt;/span&gt;layout.createSequentialGroup()&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;        &lt;/span&gt;.addContainerGap()&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;        &lt;/span&gt;.addComponent(jLblTitle)&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;        &lt;/span&gt;.addPreferredGap(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;          &lt;/span&gt;javax.swing.LayoutStyle.ComponentPlacement.RELATED,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;          &lt;/span&gt;32, Short.MAX_VALUE)&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;        &lt;/span&gt;.addGroup(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;          &lt;/span&gt;layout.createParallelGroup(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;            &lt;/span&gt;javax.swing.GroupLayout.Alignment.BASELINE)&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;            &lt;/span&gt;.addComponent(jLblName)&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;            &lt;/span&gt;.addComponent(&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;              &lt;/span&gt;jTxtFldName,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;              &lt;/span&gt;javax.swing.GroupLayout.PREFERRED_SIZE,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;              &lt;/span&gt;javax.swing.GroupLayout.DEFAULT_SIZE,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;              &lt;/span&gt;javax.swing.GroupLayout.PREFERRED_SIZE)&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;            &lt;/span&gt;.addComponent(jBtOK))&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;        &lt;/span&gt;.addGap(24, 24, 24)));&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;pack();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;private JButton jBtOK;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;private JLabel jLblName;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;private JLabel jLblTitle;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;private JTextField jTxtFldName;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;}&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Agora só testar nosso projeto, veja como ficou:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC-fBcqRHii_qDyoyk101KVoLeE9HHr61Q1XwdP7eUmh-QfNde00ful_AWXqC7aGPJ-yVN1cGPzhsRTJNAoUqobVUjVl-DXvyaPSNfVwkaFYJhheVxoJF6Ch61vz0fL8mf-zlG3k1QGc_-/s400/3.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC-fBcqRHii_qDyoyk101KVoLeE9HHr61Q1XwdP7eUmh-QfNde00ful_AWXqC7aGPJ-yVN1cGPzhsRTJNAoUqobVUjVl-DXvyaPSNfVwkaFYJhheVxoJF6Ch61vz0fL8mf-zlG3k1QGc_-/s400/3.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5596612247527560722&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 247px; &quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Bom galera, enfim, terminamos nosso projeto, que na primeira parte, criamos nosso camada de EJB2 e na segunda criamos um projeto web e Swing para acessar o EJB.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para quem quiser baixar todos os projeto desenvolvidos, &lt;a href=&quot;http://www.4shared.com/file/nanUMPjr/EJB2_em_Client_Servlet_e_Swing.html&quot;&gt;clique aqui&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Qualque dúvida, crítica ou sugestão, fico à disposição.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/5633152675357305058/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2011/05/utilizando-ejb2-com-client-servlet-e.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/5633152675357305058'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/5633152675357305058'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2011/05/utilizando-ejb2-com-client-servlet-e.html' title='Utilizando EJB2 com Client Servlet e Swing (Parte 2)'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9IefHmDyOM4m8YHNrpRz3K4v24_CvIVxi-qGaXCJ2lFGYDNcoNSTt47m6HPmCfE4-KjbwgeA9mCOKzER8Ol9-Zq-Xaq-xxTpMgaMEfu9TwzVLFmytfR1dEAmd796B9FJ8kAN6Gy4prldK/s72-c/2.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-6452211370940166401</id><published>2011-04-17T02:03:00.000-07:00</published><updated>2011-04-18T13:20:38.794-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="EJB"/><category scheme="http://www.blogger.com/atom/ns#" term="JBoss"/><title type='text'>Utilizando EJB2 com Client Servlet e Swing (Parte 1)</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Com a chegada do EJB3, ficou bem mais simples, desenvolver aplicações que usam Session Bean e Entity, devido a utilização das Annotations, evitando de ficar configurando arquivos XMLs. Entretanto, existe várias aplicações no mercado que utilizam o uso de EJB2, por este motivo, resolvi criar este post, que tem como objetivo, mostrar, como que desenvolve uma aplicação em EJB2 que servirá como nosso modelo, e para utilizar este serviço, iremos usar 2 maneiras, uma usando Servlet e a outra Swing para acessar o EJB2.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Este post terá 2 partes, essa primeira, será o desenvolvimento da camada EJB2 e a segunda parte, criaremos um Client Servlet e Swing. Para o desenvolvimento do projeto, irei utilizar Java 1.6, Eclipse e o JBoss 4.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. Passo: Vejamos a estrutura da camada de EJB:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;br /&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYHfOriShz74Jtb1qKZ9zQUfqkmlQGWwwK2xaGdRJ1C_rq-V0d67eQwNPSP0bdvRZP2wT0T5oIOWQeY_EYRTdw-tylH39i-OWrplDTBnMsfpEMSKMtErJbZuVtavsV8fq60SjYUhO5nGT9/s400/1.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYHfOriShz74Jtb1qKZ9zQUfqkmlQGWwwK2xaGdRJ1C_rq-V0d67eQwNPSP0bdvRZP2wT0T5oIOWQeY_EYRTdw-tylH39i-OWrplDTBnMsfpEMSKMtErJbZuVtavsV8fq60SjYUhO5nGT9/s400/1.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5596491621738833506&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 283px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2. Passo: Crie um projeto chamado ExemploEJB2 do tipo EJB no Eclipse, neste projeto vamos criar duas Interfaces (Remote e Home) e um SessionBean.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Primeiro criamos a Interface Remote e declaramos nosso método de serviço, neste exemplo é bem simples, teremos um método para mostrar o nome de uma Pessoa.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;package com.blogpost.jabesfelipe.service;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import java.rmi.RemoteException;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.ejb.EJBObject;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;public interface Hello extends EJBObject {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public String showName(String name) throws RemoteException;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;}&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Hello.java&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Criamos a Interface Home:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;package com.blogpost.jabesfelipe.service;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import java.rmi.RemoteException;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.ejb.CreateException;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.ejb.EJBHome&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;public interface HelloHome extends EJBHome {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public Hello create() throws RemoteException, CreateException;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;}&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;HelloHome.java&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Agora criamos nosso SessionBean e iremos implementar nosso método que foi declarado na Interface:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;package com.blogpost.jabesfelipe.service;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import java.rmi.RemoteException;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.ejb.CreateException;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.ejb.EJBException;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.ejb.SessionBean;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.ejb.SessionContext;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;public class HelloBean implements SessionBean {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public String showName(String name) {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;return &quot;Meu nome é &quot; + name + &quot;!&quot;;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public void ejbCreate() throws CreateException {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;System.out.println(&quot;Bean criado&quot;);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;@Override&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public void ejbActivate() throws EJBException, RemoteException {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;System.out.println(&quot;Bean ativado&quot;);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;@Override&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public void ejbPassivate() throws EJBException, RemoteException {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;System.out.println(&quot;Bean desativado&quot;);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;@Override&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public void ejbRemove() throws EJBException, RemoteException {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;System.out.println(&quot;Bean removido&quot;);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;@Override&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public void setSessionContext(SessionContext arg0) throws EJBException,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;RemoteException {}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;}&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;HelloBean.java&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;3. Passo: Agora vamos configurar (name, state, etc...) do EJB no arquivo ejb-jar.xml que fica dentro da pasta META-INF.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;O arquivo vai ficar conforme o modelo abaixo:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;!DOCTYPE ejb-jar PUBLIC &quot;-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN&quot; &quot;http://java.sun.com/dtd/ejb-jar_2_0.dtd&quot;&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;ejb-jar id=&quot;ejb-jar_ID&quot;&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;display-name&amp;gt;ExemploEJB2&amp;lt;/display-name&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;enterprise-beans&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;session&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;display-name&amp;gt;HelloBean&amp;lt;/display-name&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;ejb-name&amp;gt;HelloBean&amp;lt;/ejb-name&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;home&amp;gt;com.blogpost.jabesfelipe.service.HelloHome&amp;lt;/home&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;remote&amp;gt;com.blogpost.jabesfelipe.service.Hello&amp;lt;/remote&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;ejb-class&amp;gt;com.blogpost.jabesfelipe.service.HelloBean&amp;lt;/ejb-class&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;session-type&amp;gt;Stateless&amp;lt;/session-type&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;transaction-type&amp;gt;Bean&amp;lt;/transaction-type&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;/session&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/enterprise-beans&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;/ejb-jar&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;ejb-jar.xml&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;4. Passo: Vamos criar um arquivo jboss.xml dentra da pasta META-INF, e neste arquivo definimos o nome da JNDI que irá acessar o EJB.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;?xml version=&#39;1.0&#39; encoding=&#39;UTF-8&#39; ?&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;jboss&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;enterprise-beans&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;session&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;ejb-name&amp;gt;HelloBean&amp;lt;/ejb-name&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;jndi-name&amp;gt;HelloBean&amp;lt;/jndi-name&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;/session&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/enterprise-beans&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;/jboss&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;jboss.xml&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;5. Passo: O nosso EJB está pronto, agora crie um projeto chamado ExemploEJB2-ear do tipo EAR, e vamos configurar o módulo EJB no arquivo application.xml que fica dentro da pasta META-INF.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;application xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot; xmlns:application=&quot;http://java.sun.com/xml/ns/javaee/application_5.xsd&quot; xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd&quot; id=&quot;Application_ID&quot; version=&quot;5&quot;&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;  &amp;lt;display-name&amp;gt;ExemploEJB2-ear&amp;lt;/display-name&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;  &amp;lt;module&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;    &amp;lt;ejb&amp;gt;ExemploEJB2.jar&amp;lt;/ejb&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;  &amp;lt;/module&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;/application&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Bom galera, nossa camada de EJB, está pronta, e na próxima parte do tutorial, vamos testa-lá, usando Servlet e Swing.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Qualquer dúvida, crítica ou segestão, fico à disposição.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/6452211370940166401/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2011/04/utilizando-ejb2-em-client-servlet-e.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/6452211370940166401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/6452211370940166401'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2011/04/utilizando-ejb2-em-client-servlet-e.html' title='Utilizando EJB2 com Client Servlet e Swing (Parte 1)'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYHfOriShz74Jtb1qKZ9zQUfqkmlQGWwwK2xaGdRJ1C_rq-V0d67eQwNPSP0bdvRZP2wT0T5oIOWQeY_EYRTdw-tylH39i-OWrplDTBnMsfpEMSKMtErJbZuVtavsV8fq60SjYUhO5nGT9/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-1635157739183441442</id><published>2011-01-29T09:58:00.000-08:00</published><updated>2011-01-29T10:52:41.221-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Util"/><title type='text'>Revisar códigos Java com PMD</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Quando terminamos de programar determinado código, as vezes, não fazemos uma revisão no código, seja, por falta de tempo, falta de hábito, enfim.... Por isso, resolvi criar este post, para mostrar uma solução para esses casos, simplesmente, vamos usar o PMD, o que é PMD?&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;PMD é um projeto OpenSource usado para verificar códigos e mostrar os determinados erros que ocorrem nos códigos.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para facilitar ainda mais nossos testes, vamos baixar o plugin do PMD para o Eclipse, acesse o Menu -&gt; Help -&gt; Install New Software, depois adiciona um novo endereço, deixa o name como PMD e o location como &lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 14px; line-height: 21px; &quot;&gt;&lt;a href=&quot;http://pmd.sourceforge.net/eclipse&quot; target=&quot;_blank&quot; style=&quot;color: rgb(68, 83, 149); text-decoration: none; &quot;&gt;http://pmd.sourceforge.net/eclipse&lt;/a&gt;, &lt;/span&gt;para este exemplo estou usando o plugin para o Eclipse 3.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Criei um novo  Java Project, e depois criei uma Classe Dog.java, como descreve a imagem abaixo:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNTlm6hV3sh_LCKlS4l_Ker8ZbMnuu80mBZ2MoSkEBX5O22WawnDNLB1pyw-AnvIvFH6Oghj8fi7cnBce_XYEcBiY6UtgNKBc2lq70yoI4AQHlJHjf_AwNZvpqkI4jMWzfWy_xc0it52_V/s1600/1png.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNTlm6hV3sh_LCKlS4l_Ker8ZbMnuu80mBZ2MoSkEBX5O22WawnDNLB1pyw-AnvIvFH6Oghj8fi7cnBce_XYEcBiY6UtgNKBc2lq70yoI4AQHlJHjf_AwNZvpqkI4jMWzfWy_xc0it52_V/s400/1png.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5567674263708930434&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 225px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Essa é uma simples Classe, entretanto o código dela, tem uma redundância, vamos executar o PMD para testar o código.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Clique com o botão direito na Classe Dog.java -&gt; PMD -&gt; Check Code With PMD.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYJ7jTkj3cfLUH_IMaNfSKKPlTdqWmL8Q1xRJ4GYvyPHMSfurcQuRxoLZiby7XsAny3LjeTWEfb0scKrQI_xbAXenyM-K1LcEIDi7cVONsagd6AM_RYZK3cHliaAV8FAuy8EwYdV80JUMF/s400/2.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYJ7jTkj3cfLUH_IMaNfSKKPlTdqWmL8Q1xRJ4GYvyPHMSfurcQuRxoLZiby7XsAny3LjeTWEfb0scKrQI_xbAXenyM-K1LcEIDi7cVONsagd6AM_RYZK3cHliaAV8FAuy8EwYdV80JUMF/s400/2.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5567681330305973634&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 233px; &quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Como vemos na imagem, a guia Violations Overview, mostrou uma ocorrência, que está na linha 10, está dizendo que a variável de referência dog está recebendo dois novos objetos, o que está na linha 10 e na linha 17, simplesmente, poderia ter um apenas.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;O PMD não restringe apenas como esse teste, pode ser feito vários tipos que verificação em códigos, e também pode configurar o PMD com regras especificas para determinados testes.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Qualquer dúvida, crítica ou sugestão, fico à disposição.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/1635157739183441442/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2011/01/revisar-codigos-java-com-pmd.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/1635157739183441442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/1635157739183441442'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2011/01/revisar-codigos-java-com-pmd.html' title='Revisar códigos Java com PMD'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNTlm6hV3sh_LCKlS4l_Ker8ZbMnuu80mBZ2MoSkEBX5O22WawnDNLB1pyw-AnvIvFH6Oghj8fi7cnBce_XYEcBiY6UtgNKBc2lq70yoI4AQHlJHjf_AwNZvpqkI4jMWzfWy_xc0it52_V/s72-c/1png.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-2392265921473879845</id><published>2010-11-27T14:15:00.000-08:00</published><updated>2010-12-02T14:42:07.578-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="JBoss"/><category scheme="http://www.blogger.com/atom/ns#" term="Struts"/><title type='text'>Simples Exemplo Struts</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Depois de um bom tempo, sem publicar um post, irei mostrar, como criar uma simples aplicação web, usando o FrameWork Struts 1.3. Para quem não conhece, o Struts é um framework open-source do projeto Jakarta, ele possibilita o desenvolvimento de aplicacões web, atuando como um Controller no padrão MVC e também oferece suporte na camada View, para a construção de páginas JSP através de custom tags.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;O exemplo deste post é simples, teremos um formulário para preencher os dados de uma Pessoa, se a idade desta pessoa for maior de 18 anos, encaminhamos para uma página de sucesso, caso contrário, encaminhamos para uma página de falha. O projeto foi desenvolvido, usando o Eclipse + JBoss.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;O Struts pode ser baixado no site &lt;a href=&quot;http://struts.apache.org/download.cgi&quot;&gt;http://struts.apache.org/download.cgi&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Ao final do post, o projeto será disponibilizado para download, com as libs, já inclusa.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. Passo: Estrutura do projeto:&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEga63_BltKflrP43oPcsGk4OAoPzSQdtbREzkcNAcv8usdQRf9NMkQEdFHXCpnTws74c2GR8YgdqcWglAvDSWk5XzTy1_Co6-y74fqmKJBtBUpf5rdkbY7wOCGF_s_lzfAw0ecLgnALb3YK/s1600/1.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEga63_BltKflrP43oPcsGk4OAoPzSQdtbREzkcNAcv8usdQRf9NMkQEdFHXCpnTws74c2GR8YgdqcWglAvDSWk5XzTy1_Co6-y74fqmKJBtBUpf5rdkbY7wOCGF_s_lzfAw0ecLgnALb3YK/s400/1.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5544357324808702530&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 270px; height: 399px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2. Passo: Crie uma Classe, chamada Pessoa:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;package com.blogspot.jabesfelipe.struts.bean;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;public class Pessoa {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;private String nome;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;private int idade;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;private float altura;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;private char sexo;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;public String getNome() {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;return nome;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;public void setNome(String nome) {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;this.nome = nome;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;public int getIdade() {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;return idade;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;public void setIdade(int idade) {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;this.idade = idade;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;public float getAltura() {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;return altura;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;public void setAltura(float altura) {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;this.altura = altura;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;public char getSexo() {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;return sexo;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;public void setSexo(char sexo) {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;this.sexo = sexo;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Pessoa.java&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;3. Passo: Crie uma Classe, chamada PessoaFormBean, ela vai extender da Classe ActionForm, os form-beans se integram a um formulário de entrada de dados.&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;package com.blogspot.jabesfelipe.struts.formbean;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import org.apache.struts.action.ActionForm;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import com.blogspot.jabesfelipe.struts.bean.Pessoa;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;public class PessoaFormBean extends ActionForm {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;/**&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; * &lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt; */&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;private static final long serialVersionUID = -759773695806534156L;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;private Pessoa pessoa = new Pessoa();&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;public Pessoa getPessoa() {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;return pessoa;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;PessoaFormBean.java&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;4. Passo: Crie uma Classe, chamada PessoaAction, ela vai extender da Classe Action, e vamos sobrescrever o método execute, que funciona como um método main, esta Classe irá funcionar como o nosso Controller, o método execute, irá retornar um ActionForward, o mapeamento, será configurado no arquivo struts-config.xml.&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;package com.blogspot.jabesfelipe.struts.action;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.servlet.http.HttpServletRequest;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import javax.servlet.http.HttpServletResponse;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import org.apache.struts.action.Action;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import org.apache.struts.action.ActionForm;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import org.apache.struts.action.ActionForward;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import org.apache.struts.action.ActionMapping;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import com.blogspot.jabesfelipe.struts.bean.Pessoa;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;import com.blogspot.jabesfelipe.struts.formbean.PessoaFormBean;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;public class PessoaAction extends Action {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;public static final String SUCESSO = &quot;sucesso&quot;;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;public static final String FALHA = &quot;falha&quot;;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;public static final String PESSOA = &quot;pessoa&quot;;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;@Override&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;public ActionForward execute(ActionMapping mapping, ActionForm form,&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;HttpServletRequest request, HttpServletResponse response)&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;throws Exception {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;Pessoa pessoa = ((Pessoa) ((PessoaFormBean) form).getPessoa());&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;boolean podeEntrar = false;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;if (pessoa.getIdade() &gt;= 18) {&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;podeEntrar = true;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;request.setAttribute(PESSOA, pessoa);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;return podeEntrar ? mapping.findForward(SUCESSO) : mapping.findForward(FALHA);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;}&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;PessoaAction.java&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;5. Passo: Vamos criar nossas páginas JSPs, crie uma página index.jsp:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;%@taglib uri=&quot;http://struts.apache.org/tags-logic&quot; prefix=&quot;logic&quot;%&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;%@taglib uri=&quot;http://struts.apache.org/tags-html&quot; prefix=&quot;html&quot;%&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;%@taglib uri=&quot;http://struts.apache.org/tags-bean&quot; prefix=&quot;bean&quot;%&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;logic:forward name=&quot;index&quot; /&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;index.jsp&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;6. Passo: Crie um JSP, para o formulário:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;%@taglib uri=&quot;http://struts.apache.org/tags-logic&quot; prefix=&quot;logic&quot;%&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;%@taglib uri=&quot;http://struts.apache.org/tags-html&quot; prefix=&quot;html&quot;%&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;%@taglib uri=&quot;http://struts.apache.org/tags-bean&quot; prefix=&quot;bean&quot;%&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;html:html&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;html:base/&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=ISO-8859-1&quot;&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;title&amp;gt;Simples Exemplo Struts&amp;lt;/title&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;/head&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;html:form focus=&quot;pessoa.nome&quot; action=&quot;/PessoaAction.do&quot; method=&quot;POST&quot;&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;Nome: &amp;lt;html:text property=&quot;pessoa.nome&quot; /&amp;gt;&amp;lt;br /&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;Idade: &amp;lt;html:text property=&quot;pessoa.idade&quot; /&amp;gt;&amp;lt;br /&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;Altura: &amp;lt;html:text property=&quot;pessoa.altura&quot; /&amp;gt;&amp;lt;br /&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;Sexo: &amp;lt;html:radio property=&quot;pessoa.sexo&quot; value=&quot;M&quot; /&amp;gt;Masculino&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;  &amp;lt;html:radio property=&quot;pessoa.sexo&quot; value=&quot;F&quot; /&amp;gt;Feminino&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&amp;lt;html:submit value=&quot;Ok&quot;/&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;/html:form&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;/body&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;/html:html&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;formulario.jsp&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;7. Passo: Crie, agora a página de sucesso:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;%@taglib uri=&quot;http://struts.apache.org/tags-logic&quot; prefix=&quot;logic&quot;%&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;%@taglib uri=&quot;http://struts.apache.org/tags-html&quot; prefix=&quot;html&quot;%&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;%@taglib uri=&quot;http://struts.apache.org/tags-bean&quot; prefix=&quot;bean&quot;%&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;html:html&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;html:base/&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=ISO-8859-1&quot;&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;title&amp;gt;Simples Exemplo Struts&amp;lt;/title&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;/head&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;bean:define id=&quot;pessoa&quot; name=&quot;pessoa&quot; scope=&quot;request&quot; /&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;Olá &amp;lt;bean:write name=&quot;pessoa&quot; property=&quot;nome&quot;/&amp;gt;, SEJA BEM VINDO!!! &amp;lt;br /&amp;gt; &lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;Sexo: &lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;logic:equal value=&quot;M&quot; name=&quot;pessoa&quot; property=&quot;sexo&quot;&amp;gt;Masculino&amp;lt;/logic:equal&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;logic:equal value=&quot;F&quot; name=&quot;pessoa&quot; property=&quot;sexo&quot;&amp;gt;Feminino&amp;lt;/logic:equal&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;br /&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;html:link action=&quot;/Index.do&quot;&amp;gt;sair...&amp;lt;/html:link&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;/body&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;/html:html&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;sucesso.jsp&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;8. Passo: Crie, agora a página de falha:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;%@taglib uri=&quot;http://struts.apache.org/tags-logic&quot; prefix=&quot;logic&quot;%&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;%@taglib uri=&quot;http://struts.apache.org/tags-html&quot; prefix=&quot;html&quot;%&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;%@taglib uri=&quot;http://struts.apache.org/tags-bean&quot; prefix=&quot;bean&quot;%&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;html:html&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;html:base /&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=ISO-8859-1&quot;&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;title&amp;gt;Simples Exemplo Struts&amp;lt;/title&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;/head&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;bean:define id=&quot;pessoa&quot; scope=&quot;request&quot; name=&quot;pessoa&quot; /&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;Olá &amp;lt;bean:write name=&quot;pessoa&quot; property=&quot;nome&quot; /&amp;gt;.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;br /&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;br /&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;VOCÊ É MENOR DE IDADE E NÃO PODE ENTRAR!!!&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;br /&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;html:link action=&quot;/Index.do&quot;&amp;gt;voltar...&amp;lt;/html:link&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;/body&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;/html:html&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;falha.jsp&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;9. Passo: Agora, precisamos configurar o struts no arquivo web.xml:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;web-app xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot; xmlns:web=&quot;http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;id=&quot;WebApp_ID&quot; version=&quot;2.5&quot;&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;display-name&amp;gt;struts-exemplo&amp;lt;/display-name&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;welcome-file-list&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&amp;lt;welcome-file&amp;gt;index.jsp&amp;lt;/welcome-file&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;/welcome-file-list&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;servlet&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&amp;lt;servlet-name&amp;gt;action&amp;lt;/servlet-name&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&amp;lt;servlet-class&amp;gt;org.apache.struts.action.ActionServlet&amp;lt;/servlet-class&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&amp;lt;init-param&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&amp;lt;param-name&amp;gt;config&amp;lt;/param-name&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&amp;lt;param-value&amp;gt;/WEB-INF/struts-config.xml&amp;lt;/param-value&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&amp;lt;/init-param&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&amp;lt;load-on-startup&amp;gt;1&amp;lt;/load-on-startup&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;/servlet&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;servlet-mapping&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&amp;lt;servlet-name&amp;gt;action&amp;lt;/servlet-name&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&amp;lt;url-pattern&amp;gt;*.do&amp;lt;/url-pattern&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;/servlet-mapping&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;/web-app&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;web.xml&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;10. Passo: A configuração do arquivo struts-config, incluindo as as definições dos beans, &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;e os mapeamento das actions:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;struts-config&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;!-- FORWARDS GLOBAL --&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;global-forwards&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&amp;lt;forward name=&quot;index&quot; path=&quot;/Index.do&quot; /&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;/global-forwards&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;form-beans&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&amp;lt;!-- FORM PESSOA --&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&amp;lt;form-bean name=&quot;PessoaFormBean&quot; type=&quot;com.blogspot.jabesfelipe.struts.formbean.PessoaFormBean&quot; /&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;/form-beans&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;action-mappings&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&amp;lt;!-- PAGINA INICIAL --&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&amp;lt;action path=&quot;/Index&quot; include=&quot;/formulario.jsp&quot; scope=&quot;request&quot; /&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&amp;lt;action name=&quot;PessoaFormBean&quot; type=&quot;com.blogspot.jabesfelipe.struts.action.PessoaAction&quot; &lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;path=&quot;/PessoaAction&quot; scope=&quot;request&quot;&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&amp;lt;forward name=&quot;sucesso&quot; path=&quot;/sucesso.jsp&quot;/&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;			&lt;/span&gt;&amp;lt;forward name=&quot;falha&quot; path=&quot;/falha.jsp&quot;/&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;		&lt;/span&gt;&amp;lt;/action&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;	&lt;/span&gt;&amp;lt;/action-mappings&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&amp;lt;/struts-config&amp;gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;struts-config.xml&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;11. Passo: A aplicação rodando, preenchendo o formulário:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;meta equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiek5uk6oTX1OffzVGfkOb_mNhnW6pkxuZuyioCNZME3mIg90RhXTxmIiPlTe5-yxoW8JiBPUCo-ko1y5EUxUfOUzSRVPd6yDV4BqiSNnBy31rQ0D_gbs-K3tlhjeGxpqCjTyzhE5j3aXN8/s1600/2.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiek5uk6oTX1OffzVGfkOb_mNhnW6pkxuZuyioCNZME3mIg90RhXTxmIiPlTe5-yxoW8JiBPUCo-ko1y5EUxUfOUzSRVPd6yDV4BqiSNnBy31rQ0D_gbs-K3tlhjeGxpqCjTyzhE5j3aXN8/s400/2.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5544358164453498594&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 308px; &quot; /&gt;&lt;/a&gt;&lt;meta equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhk-Wlgutn1YIDSGivkzQf8fFQp_oZBRbXQKPAPGaF_9rAW0t6JyinPejBV368g5ZkgHRy4jP6JbOTl1abwreeMPTGhDFff-lRcagivN1wVVo33scqe-zo5E_68vhwQ4NzDGDc5uDLqhRdh/s1600/3.png&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt; Caso seja sucesso:&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;meta equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhk-Wlgutn1YIDSGivkzQf8fFQp_oZBRbXQKPAPGaF_9rAW0t6JyinPejBV368g5ZkgHRy4jP6JbOTl1abwreeMPTGhDFff-lRcagivN1wVVo33scqe-zo5E_68vhwQ4NzDGDc5uDLqhRdh/s1600/3.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhk-Wlgutn1YIDSGivkzQf8fFQp_oZBRbXQKPAPGaF_9rAW0t6JyinPejBV368g5ZkgHRy4jP6JbOTl1abwreeMPTGhDFff-lRcagivN1wVVo33scqe-zo5E_68vhwQ4NzDGDc5uDLqhRdh/s400/3.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5544358164303920546&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 352px; height: 250px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Se for falha:&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;meta equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiSMRm1k00Ubo163fSrny5tym5ZFvCttgwwna26zEbczc__RzAcIUg2NXw2r0iMSbBY42l7w6YOm6U2o1TDLkRMje4dOk1xjDWUsHNOKLDsCb5Ic41cUbpyylagl-HZoqlnYoAhRAcb1Bp/s1600/4.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiSMRm1k00Ubo163fSrny5tym5ZFvCttgwwna26zEbczc__RzAcIUg2NXw2r0iMSbBY42l7w6YOm6U2o1TDLkRMje4dOk1xjDWUsHNOKLDsCb5Ic41cUbpyylagl-HZoqlnYoAhRAcb1Bp/s400/4.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5544358172171490370&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 251px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;meta equiv=&quot;content-type&quot; content=&quot;text/html; charset=utf-8&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: 14px; line-height: 22px; &quot;&gt;&lt;div style=&quot;text-align: justify; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;Bom galera, este foi um exemplo de como criar uma simples aplicação web com FrameWork Struts.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;Para quem quiser baixar o exemplo, &lt;span class=&quot;Apple-style-span&quot;&gt;&lt;a href=&quot;http://www.4shared.com/file/oCOP154w/struts-exemplo.html&quot;&gt;clique aqui&lt;/a&gt;&lt;/span&gt;.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;Qualquer dúvida, crítica ou sugestão, fico à disposição.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify; font-family: arial, verdana, serif; color: rgb(51, 51, 51); &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/2392265921473879845/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/11/simples-aplicacao-web-com-struts.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/2392265921473879845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/2392265921473879845'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/11/simples-aplicacao-web-com-struts.html' title='Simples Exemplo Struts'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEga63_BltKflrP43oPcsGk4OAoPzSQdtbREzkcNAcv8usdQRf9NMkQEdFHXCpnTws74c2GR8YgdqcWglAvDSWk5XzTy1_Co6-y74fqmKJBtBUpf5rdkbY7wOCGF_s_lzfAw0ecLgnALb3YK/s72-c/1.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-8002085796216203692</id><published>2010-09-30T16:20:00.000-07:00</published><updated>2010-10-02T17:21:38.190-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Loop Map</title><content type='html'>&lt;div style=&quot;TEXT-ALIGN: justify&quot;&gt;Olá Pessoal,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A Interface Map é bem útil, pois permite que criamos mapas de chaves/valor. O Map possibilita que uma chave única seja criada, que pode ser um tipo primitivo ou um objeto, cada chave poderá apontar para um valor que também pode ser um primitivo ou objeto.&lt;br /&gt;Neste exemplo temos um Map de números, e para percorre-lô, usaremos a Interface Set, que irá obter as Keys do Map, e depois iremos interar usando o Foreach.&lt;br /&gt;Segue um exemplo para fazer um loop em Map:&lt;br /&gt;&lt;code&gt;&lt;br /&gt;import java.util.HashMap;&lt;br /&gt;import java.util.Map;&lt;br /&gt;import java.util.Set;&lt;br /&gt;&lt;br /&gt;public class LoopMap {&lt;br /&gt;&lt;br /&gt;public static void main(String[] args) {&lt;br /&gt;&lt;br /&gt;Map&lt;integer, string=&quot;&quot;&gt; mapa = new HashMap&lt;integer, string=&quot;&quot;&gt;();&lt;br /&gt;mapa.put(1, &quot;UM&quot;);&lt;br /&gt;mapa.put(2, &quot;DOIS&quot;);&lt;br /&gt;mapa.put(3, &quot;TRES&quot;);&lt;br /&gt;mapa.put(4, &quot;QUATRO&quot;);&lt;br /&gt;mapa.put(5, &quot;CINCO&quot;);&lt;br /&gt;&lt;br /&gt;Set&lt;integer&gt; conjunto = mapa.keySet();&lt;br /&gt;for (Integer key : conjunto) {&lt;br /&gt;System.out.println(&quot;Key: &quot; + key + &quot; - Valor: &quot; + mapa.get(key)); &lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;TEXT-ALIGN: justify&quot;&gt;&lt;code&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/integer&gt;&lt;/INTEGER,&gt;&lt;/INTEGER,&gt;&lt;/code&gt;LoopMap.java&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Resultado:&lt;br /&gt;&lt;code&gt;Key: 1 - Valor: UM&lt;br /&gt;Key: 2 - Valor: DOIS&lt;br /&gt;Key: 3 - Valor: TRES&lt;br /&gt;Key: 4 - Valor: QUATRO&lt;br /&gt;Key: 5 - Valor: CINCO&lt;br /&gt;&lt;/div&gt;&lt;/code&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/8002085796216203692/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/09/loop-map.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/8002085796216203692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/8002085796216203692'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/09/loop-map.html' title='Loop Map'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-4236504658074064307</id><published>2010-09-06T14:33:00.000-07:00</published><updated>2010-09-06T16:30:34.741-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="JBoss"/><category scheme="http://www.blogger.com/atom/ns#" term="JSP e Servlet"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><title type='text'>Exemplo DataSource JBoss</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Afinal, o que é um DataSource?&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;DataSource é uma forma de guardar as configurações de conexão com o banco de dados, como por exemplo, deixá-las em um arquivo xml, evitando assim, que as mesmas não ficam fixas no seu código Java.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Neste exemplo, será criado um DataSource que será usado no servidor JBoss 4, a vantagem de usar o JBoss, é que o DS pode ser criado diretamente na pasta de deploy, proporcionando mais liberdade para o desenvolvedor.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;A estrutura do arquivo xml do DS, é definida logo abaixo:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;datasources&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;local-tx-datasource&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;jndi-name&amp;gt;jdbc/CLIENTEDS&amp;lt;/jndi-name&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;connection-url&amp;gt;URL&amp;lt;/connection-url&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;driver-class&amp;gt;DRIVER_CLASSE&amp;lt;/driver-class&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;user-name&amp;gt;USUARIO&amp;lt;/user-name&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;password&amp;gt;SENHA&amp;lt;/password&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/local-tx-datasource&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/datasources&amp;gt;&lt;/div&gt;&lt;/code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Legenda:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;CLIENTEDS = Nome da datasource que será configurada em sua aplicação&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;URL = Endereço de sua base&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;DRIVER_CLASSE = Driver de acesso ao banco de dados&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;USUARIO = Usuário de acesso base de dados&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;SENHA = Senha de acesso a base de dados&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Por exemplo, vamos configurar, para acessar o banco de dados MySQL:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Crie um arquivo xml, com o nome de database-ds.xml, salve este arquivo no seguinte diretório:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;            DIRETORIO_DO_SEU_JBOSS/server/default/deploy&lt;/div&gt;&lt;/code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;No conteúdo do arquivo, deixei configurado assim:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;datasources&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt; &amp;lt;local-tx-datasource&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    &amp;lt;jndi-name&amp;gt;jdbc/databaseDS&amp;lt;/jndi-name&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    &amp;lt;connection-url&amp;gt;jdbc:mysql://localhost:3306/java&amp;lt;/connection-url&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    &amp;lt;driver-class&amp;gt;com.mysql.jdbc.Driver&amp;lt;/driver-class&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    &amp;lt;user-name&amp;gt;root&amp;lt;/user-name&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    &amp;lt;password&amp;gt;root&amp;lt;/password&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    &amp;lt;min-pool-size&amp;gt;5&amp;lt;/min-pool-size&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    &amp;lt;max-pool-size&amp;gt;30&amp;lt;/max-pool-size&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    &amp;lt;idle-timeout-minutes&amp;gt;1&amp;lt;/idle-timeout-minutes&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    &amp;lt;prepared-statement-cache-size&amp;gt;32&amp;lt;/prepared-statement-cache-size&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;  &amp;lt;/local-tx-datasource&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/datasources&amp;gt;&lt;/div&gt;&lt;/code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;database-ds.xml&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Obs.: Não esqueça de colocar o jar do driver do MySQL, no seguinte diretório: &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;            DIRETORIO_DO_SEU_JBOSS/server/default/lib&lt;/div&gt;&lt;/code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Bom, para testar o DataSource, vamos criar um novo projeto web no Eclipse, chamado ExemploDataSource.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Crie um novo file, chamado persistence.xml, dentro da pasta WebContent/META-INF.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;persistence version=&quot;1.0&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns=&quot;http://java.sun.com/xml/ns/persistence&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;persistence-unit name=&quot;PessoaJPAData&quot; transaction-type=&quot;JTA&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;provider&amp;gt;org.hibernate.ejb.HibernatePersistence&amp;lt;/provider&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;jta-data-source&amp;gt;java:/jdbc/databaseDS&amp;lt;/jta-data-source&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;properties&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;property name=&quot;hibernate.hbm2ddl.auto&quot; value=&quot;update&quot; /&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;/properties&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/persistence-unit&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/persistence&amp;gt;&lt;/div&gt;&lt;/code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;persistence.xml&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Definimos o nome do persistence-unit;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Usamos o Hibernate como provedor JPA;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Colocamos o nome do DS no jta-data-source;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;E, por fim, defiminos, que o Hibernate crie automaticamente nossas tabelas do BD.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Agora, vamos criar um Servlet, chamado ServletDS.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;package com.blogspot.jabesfelipe.servlet;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import java.io.IOException;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import java.io.PrintWriter;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import java.sql.Connection;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import javax.naming.Context;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import javax.naming.InitialContext;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import javax.servlet.ServletException;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import javax.servlet.http.HttpServlet;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import javax.servlet.http.HttpServletRequest;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import javax.servlet.http.HttpServletResponse;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import javax.sql.DataSource;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;public class ServletDS extends HttpServlet {&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;private static final long serialVersionUID = 1L;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;private void processarRequisicao(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;PrintWriter out = response.getWriter();&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;Context context = new InitialContext();&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;DataSource dataSource = (DataSource) context.lookup(&quot;java:jdbc/databaseDS&quot;);&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;Connection connection = dataSource.getConnection();&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;     &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;                        out.println(&quot;Conectado, através da JNDI!&quot;);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;connection.close();&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;} catch(Exception e) {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;processarRequisicao(request, response);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;processarRequisicao(request, response);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;}&lt;/div&gt;&lt;/code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;ServletDS.java&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Através da JNDI, acessamos nosso DataSource, para testar, inicialize seu JBoss, e digite o endereço: http://localhost:8080/ExemploDataSource/ServletDS&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Bom galera, este foi um exemplo de como criar um DataSource no JBoss, e usá-lo em uma aplicação.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para quem quiser baixar o exemplo, &lt;a href=&quot;http://www.4shared.com/file/LFBykcnD/ExemploDataSource.html&quot; target=&quot;_blank&quot;&gt;clique aqui&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Qualquer dúvida, crítica ou sugestão, fico à disposição.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/4236504658074064307/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/09/exemplo-datasource-jboss.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/4236504658074064307'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/4236504658074064307'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/09/exemplo-datasource-jboss.html' title='Exemplo DataSource JBoss'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-5574982309732628353</id><published>2010-08-28T16:16:00.000-07:00</published><updated>2010-12-02T14:45:51.086-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="JBoss"/><category scheme="http://www.blogger.com/atom/ns#" term="JSP e Servlet"/><category scheme="http://www.blogger.com/atom/ns#" term="Relatório"/><title type='text'>Exemplo de Relatório em Java para web</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Neste post, irei mostrar um exemplo de como fazer um simples relatório em Java para aplicações web, para a geração do relatório usaremos o Jasper Reports que é um Framework open-source, para a criação do layout usaremos o Framework iReport, para testarmos a aplicação, criamos um Servlet, que será executado no servidor JBoss4 usando o Eclipse.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para baixar o JasperReports: &lt;a href=&quot;http://jasperforge.org/projects/jasperreports&quot;&gt;http://jasperforge.org/projects/jasperreports&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para baixar o iReport: &lt;a href=&quot;http://jasperforge.org/projects/ireport&quot;&gt;http://jasperforge.org/projects/ireport&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Ao final do post o projeto será disponibilizado para download com todas bibliotecas usadas e os arquivos do relatório.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. Passo: Estrutura do projeto:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIkYh7EcpYd7xJy1YXAd-EXU14VYwN5e6zrOtpEjm3ad78yKS2_QQJnzZthjwjfKIuaUi8scDoGxr_UX1pgp1dzm5rjjGxQP5L9hC9TjKPgnMDXJHPFiv1bsI7Y8z4JeBZyZonlsk4e7E-/s1600/4.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIkYh7EcpYd7xJy1YXAd-EXU14VYwN5e6zrOtpEjm3ad78yKS2_QQJnzZthjwjfKIuaUi8scDoGxr_UX1pgp1dzm5rjjGxQP5L9hC9TjKPgnMDXJHPFiv1bsI7Y8z4JeBZyZonlsk4e7E-/s400/4.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5510608950743158290&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 289px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2. Passo: Vamos criar a estrutura do relatório do iReport, crie um relatório com o nome clientes, com o seguinte arquivo xml:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;jasperReport xmlns=&quot;http://jasperreports.sourceforge.net/jasperreports&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation=&quot;http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd&quot; name=&quot;clientes&quot; language=&quot;groovy&quot; pageWidth=&quot;612&quot; pageHeight=&quot;792&quot; columnWidth=&quot;555&quot; leftMargin=&quot;20&quot; rightMargin=&quot;20&quot; topMargin=&quot;20&quot; bottomMargin=&quot;20&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;property name=&quot;ireport.zoom&quot; value=&quot;1.0&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;property name=&quot;ireport.x&quot; value=&quot;0&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;property name=&quot;ireport.y&quot; value=&quot;0&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;style name=&quot;efeitoZebra&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;conditionalStyle&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;conditionExpression&amp;gt;&amp;lt;![CDATA[new Boolean(($V{COLUMN_COUNT}.intValue() % 2) != 0)]]&amp;gt;&amp;lt;/conditionExpression&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;style mode=&quot;Opaque&quot; backcolor=&quot;#BAB8B8&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;/conditionalStyle&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/style&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;parameter name=&quot;clientesLista&quot; class=&quot;java.util.List&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;parameter name=&quot;titulo&quot; class=&quot;java.lang.String&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;parameter name=&quot;total&quot; class=&quot;java.lang.String&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;field name=&quot;nome&quot; class=&quot;java.lang.String&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;field name=&quot;endereco&quot; class=&quot;java.lang.String&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;field name=&quot;email&quot; class=&quot;java.lang.String&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;field name=&quot;cidade&quot; class=&quot;java.lang.String&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;background&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;band splitType=&quot;Stretch&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/background&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;title&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;band height=&quot;38&quot; splitType=&quot;Stretch&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;textField&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;reportElement x=&quot;109&quot; y=&quot;0&quot; width=&quot;349&quot; height=&quot;35&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textElement lineSpacing=&quot;1_1_2&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;     &lt;/span&gt;&amp;lt;font size=&quot;20&quot; isBold=&quot;true&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;/textElement&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textFieldExpression class=&quot;java.lang.String&quot;&amp;gt;&amp;lt;![CDATA[$P{titulo}]]&amp;gt;&amp;lt;/textFieldExpression&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;/textField&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;/band&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/title&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;pageHeader&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;band height=&quot;17&quot; splitType=&quot;Stretch&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/pageHeader&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;columnHeader&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;band height=&quot;34&quot; splitType=&quot;Stretch&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;staticText&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;reportElement x=&quot;0&quot; y=&quot;14&quot; width=&quot;137&quot; height=&quot;20&quot; forecolor=&quot;#010101&quot; backcolor=&quot;#3B56EC&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textElement&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;     &lt;/span&gt;&amp;lt;font size=&quot;12&quot; isBold=&quot;true&quot; isItalic=&quot;true&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;/textElement&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;text&amp;gt;&amp;lt;![CDATA[Nome]]&amp;gt;&amp;lt;/text&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;/staticText&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;staticText&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;reportElement x=&quot;137&quot; y=&quot;14&quot; width=&quot;149&quot; height=&quot;20&quot; forecolor=&quot;#010101&quot; backcolor=&quot;#3B56EC&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textElement&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;     &lt;/span&gt;&amp;lt;font size=&quot;12&quot; isBold=&quot;true&quot; isItalic=&quot;true&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;/textElement&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;text&amp;gt;&amp;lt;![CDATA[Endereço]]&amp;gt;&amp;lt;/text&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;/staticText&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;staticText&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;reportElement x=&quot;286&quot; y=&quot;14&quot; width=&quot;153&quot; height=&quot;20&quot; forecolor=&quot;#010101&quot; backcolor=&quot;#3B56EC&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textElement&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;     &lt;/span&gt;&amp;lt;font size=&quot;12&quot; isBold=&quot;true&quot; isItalic=&quot;true&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;/textElement&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;text&amp;gt;&amp;lt;![CDATA[E-mail]]&amp;gt;&amp;lt;/text&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;/staticText&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;staticText&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;reportElement x=&quot;439&quot; y=&quot;14&quot; width=&quot;133&quot; height=&quot;20&quot; forecolor=&quot;#010101&quot; backcolor=&quot;#3B56EC&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textElement&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;     &lt;/span&gt;&amp;lt;font size=&quot;12&quot; isBold=&quot;true&quot; isItalic=&quot;true&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;/textElement&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;text&amp;gt;&amp;lt;![CDATA[Cidade]]&amp;gt;&amp;lt;/text&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;/staticText&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;/band&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/columnHeader&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;detail&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;band height=&quot;22&quot; splitType=&quot;Stretch&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;textField&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;reportElement style=&quot;efeitoZebra&quot; x=&quot;137&quot; y=&quot;0&quot; width=&quot;149&quot; height=&quot;20&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textElement/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textFieldExpression class=&quot;java.lang.String&quot;&amp;gt;&amp;lt;![CDATA[$F{endereco}]]&amp;gt;&amp;lt;/textFieldExpression&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;/textField&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;textField&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;reportElement style=&quot;efeitoZebra&quot; x=&quot;439&quot; y=&quot;0&quot; width=&quot;133&quot; height=&quot;20&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textElement/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textFieldExpression class=&quot;java.lang.String&quot;&amp;gt;&amp;lt;![CDATA[$F{cidade}]]&amp;gt;&amp;lt;/textFieldExpression&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;/textField&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;line&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;reportElement x=&quot;0&quot; y=&quot;20&quot; width=&quot;572&quot; height=&quot;1&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;/line&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;textField&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;reportElement style=&quot;efeitoZebra&quot; x=&quot;0&quot; y=&quot;0&quot; width=&quot;137&quot; height=&quot;20&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textElement/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textFieldExpression class=&quot;java.lang.String&quot;&amp;gt;&amp;lt;![CDATA[$F{nome}]]&amp;gt;&amp;lt;/textFieldExpression&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;/textField&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;textField&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;reportElement style=&quot;efeitoZebra&quot; x=&quot;286&quot; y=&quot;0&quot; width=&quot;153&quot; height=&quot;20&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textElement/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textFieldExpression class=&quot;java.lang.String&quot;&amp;gt;&amp;lt;![CDATA[$F{email}]]&amp;gt;&amp;lt;/textFieldExpression&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;/textField&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;/band&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/detail&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;columnFooter&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;band height=&quot;20&quot; splitType=&quot;Stretch&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;textField&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;reportElement x=&quot;391&quot; y=&quot;0&quot; width=&quot;181&quot; height=&quot;20&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textElement&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;     &lt;/span&gt;&amp;lt;font size=&quot;12&quot; isBold=&quot;true&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;/textElement&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textFieldExpression class=&quot;java.lang.String&quot;&amp;gt;&amp;lt;![CDATA[$P{total}]]&amp;gt;&amp;lt;/textFieldExpression&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;/textField&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;/band&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/columnFooter&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;pageFooter&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;band height=&quot;54&quot; splitType=&quot;Stretch&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;textField&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;reportElement x=&quot;225&quot; y=&quot;17&quot; width=&quot;80&quot; height=&quot;20&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textElement textAlignment=&quot;Right&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textFieldExpression class=&quot;java.lang.String&quot;&amp;gt;&amp;lt;![CDATA[&quot;Página &quot;+$V{PAGE_NUMBER}+&quot; de&quot;]]&amp;gt;&amp;lt;/textFieldExpression&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;/textField&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;textField evaluationTime=&quot;Report&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;reportElement x=&quot;305&quot; y=&quot;17&quot; width=&quot;40&quot; height=&quot;20&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textElement/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;textFieldExpression class=&quot;java.lang.String&quot;&amp;gt;&amp;lt;![CDATA[&quot; &quot; + $V{PAGE_NUMBER}]]&amp;gt;&amp;lt;/textFieldExpression&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;/textField&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;/band&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/pageFooter&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;summary&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;band height=&quot;42&quot; splitType=&quot;Stretch&quot;/&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/summary&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/jasperReport&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;clientes.jrxml&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;3. Passo: Vamos criar um Servlet, chamado RelatorioServlet, o foco do post é mostrar como fazer relatório em Java, para isto, deixarei toda lógica no Servlet, deixando o projeto com uma baixa coesão, fique a vontade para fazer o projeto com a separação das camadas. Crie também uma JavaBean chamado Cliente, para carregar as informações dos Clientes, criaremos um List de Clientes no próprio Servlet. O exemplo terá uma opção que visualizará o Relatório, usando o método estático viewReport da Classe JasperViewer, a outra opção será o pdf do Relatório usando o método estático printReportToPdfFile da Classe JasperPrintManager.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;package modelo;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;public class Cliente {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;private String nome;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;private String endereco;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;private String email;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;private String cidade;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public Cliente() {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;super();&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public Cliente(String nome, String endereco, String email, String cidade) {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;super();&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;this.nome = nome;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;this.endereco = endereco;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;this.email = email;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;this.cidade = cidade;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public String getNome() {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;return nome;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public void setNome(String nome) {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;this.nome = nome;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public String getEndereco() {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;return endereco;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public void setEndereco(String endereco) {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;this.endereco = endereco;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public String getEmail() {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;return email;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public void setEmail(String email) {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;this.email = email;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public String getCidade() {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;return cidade;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public void setCidade(String cidade) {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;this.cidade = cidade;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Cliente.java&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;package relatorio;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import java.io.IOException;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import java.util.ArrayList;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import java.util.HashMap;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import java.util.List;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import java.util.Map;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import javax.servlet.ServletException;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import javax.servlet.http.HttpServlet;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import javax.servlet.http.HttpServletRequest;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import javax.servlet.http.HttpServletResponse;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import modelo.Cliente;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import net.sf.jasperreports.engine.JRException;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import net.sf.jasperreports.engine.JasperFillManager;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import net.sf.jasperreports.engine.JasperPrint;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import net.sf.jasperreports.engine.JasperPrintManager;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import net.sf.jasperreports.view.JasperViewer;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;public class RelatorioServlet extends HttpServlet {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;private static final long serialVersionUID = 1L;&lt;/div&gt;&lt;div&gt;     &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    public RelatorioServlet() {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;        super();      &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    public void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;List&lt;cliente&gt; clientesLista = new ArrayList&lt;cliente&gt;();&lt;/cliente&gt;&lt;/cliente&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;clientesLista.add(new Cliente(&quot;Jabes Felipe&quot;, &quot;Copacabana, 54&quot;, &quot;jabesfelipe@gmail.com&quot;, &quot;Rio de Janeiro&quot;));&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;clientesLista.add(new Cliente(&quot;Camila Ribeiro&quot;, &quot;Ipanema,324&quot;, &quot;camilarib@gmail.com&quot;, &quot;Rio de Janeiro&quot;));&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;clientesLista.add(new Cliente(&quot;Jaque Silva&quot;, &quot;Lapa, 44&quot;, &quot;jaquesilva@gmail.com&quot;, &quot;Rio de Janeiro&quot;));&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;clientesLista.add(new Cliente(&quot;Bruna Lira&quot;, &quot;Centro, 32&quot;, &quot;brunalira@gmail.com&quot;, &quot;Rio de Janeiro&quot;));&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;clientesLista.add(new Cliente(&quot;Amanda Alves&quot;, &quot;Lapa, 342&quot;, &quot;amandaa@gmail.com&quot;, &quot;Rio de Janeiro&quot;));&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;clientesLista.add(new Cliente(&quot;Priscila Ratina&quot;, &quot;Barra Tijuca, 86&quot;, &quot;priscilaratina@gmail.com&quot;, &quot;Rio de Janeiro&quot;));&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;clientesLista.add(new Cliente(&quot;Carolina Marques&quot;, &quot;Copacabana, 234&quot;, &quot;carolinamarques@gmail.com&quot;, &quot;Rio de Janeiro&quot;));&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;try {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;String acao = request.getParameter(&quot;acao&quot;) == null ? &quot;&quot; : request.getParameter(&quot;acao&quot;);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;String caminhoJasper = getServletContext().getRealPath(&quot;/WEB-INF/classes/relatorio/&quot;) + &quot;/&quot;;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;String caminho = getServletContext().getRealPath(&quot;/&quot;);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;JRBeanCollectionDataSource jrDT = new JRBeanCollectionDataSource(clientesLista);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;Map parametros = new HashMap();&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;parametros.put(&quot;titulo&quot;, &quot;Relatórios de Clientes&quot;);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;parametros.put(clientesLista, jrDT);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;parametros.put(&quot;total&quot;, &quot;Total de Clientes: &quot; + clientesLista.size());&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;JasperPrint jasperPrint = JasperFillManager.fillReport(caminhoJasper + &quot;clientes.jasper&quot;, parametros, jrDT);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;if(&quot;visualizar&quot;.equals(acao)) {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;JasperViewer.viewReport(jasperPrint, false);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;} else if(&quot;pdf&quot;.equals(acao)) {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;JasperPrintManager.printReportToPdfFile(jasperPrint, caminho + &quot;/RelatorioCliente.pdf&quot;);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;response.sendRedirect(&quot;RelatorioCliente.pdf&quot;);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;} else {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;response.sendRedirect(&quot;index.jsp&quot;);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;     &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;} catch (JRException e) {&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;e.printStackTrace();&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;processRequest(request, response);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    }&lt;/div&gt;&lt;div&gt;    &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;processRequest(request, response);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;RelatorioServlet.java&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;3. Passo: Para testar, crie um index.jsp, como o do exemplo abaixo:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=UTF-8&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;pageEncoding=&quot;UTF-8&quot;%&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;html&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;head&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;title&amp;gt;Relatório em Java&amp;lt;/title&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;function visualizarRelatorio() {&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;enviar(&quot;visualizar&quot;);&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;function gerarRelatorioPDF() {&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;enviar(&quot;pdf&quot;);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;function enviar(acao) {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;document.forms[0].acao.value = acao;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;document.forms[0].target = &quot;_blank&quot;;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;document.forms[0].action = &quot;./RelatorioServlet&quot;;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;document.forms[0].submit();&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/script&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/head&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;body&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;h1&amp;gt;Relatório de Clientes&amp;lt;/h1&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;form action=&quot;./RelatorioServlet&quot; method=&quot;post&quot; onsubmit=&quot;return false;&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;input type=&quot;hidden&quot; name=&quot;acao&quot; /&amp;gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;input type=&quot;submit&quot; value=&quot;Visualizar Relatorio&quot; onclick=&quot;javascript:visualizarRelatorio();&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;input type=&quot;submit&quot; value=&quot;Gerar Relatório PDF&quot; onclick=&quot;javascript:gerarRelatorioPDF();&quot;&amp;gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/form&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/body&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/html&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;index.jsp&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Exemplo: Index&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5jHPeMIkfVNetFM0PtFyf621nIxpFVgZx09RhHzGEz7XppDSYQzURKy5snBMfSWwx7M3ZHfCCSa0EiZod-yR3Exh9q7oRN9mGuJWlRCYuUThfSoDak-ZwEmDsz6Rf77n6h6yIOd7DlREq/s1600/1.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5jHPeMIkfVNetFM0PtFyf621nIxpFVgZx09RhHzGEz7XppDSYQzURKy5snBMfSWwx7M3ZHfCCSa0EiZod-yR3Exh9q7oRN9mGuJWlRCYuUThfSoDak-ZwEmDsz6Rf77n6h6yIOd7DlREq/s400/1.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5510615801537014082&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 118px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Vizualizando o Relatório:&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEja-3r3CoU9Xdk7lgj52dmEX2PBGRdscncDM8d7n98kgJvOE-yjKM5EMCskl4qacO-0uRpYjotAI-axdvwyeO9vM8DmGKkz3ftd_dXhPrYMo-p1q8t5DGIqhCQzm8UWibZIotdx8CIKqO4U/s1600/2.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEja-3r3CoU9Xdk7lgj52dmEX2PBGRdscncDM8d7n98kgJvOE-yjKM5EMCskl4qacO-0uRpYjotAI-axdvwyeO9vM8DmGKkz3ftd_dXhPrYMo-p1q8t5DGIqhCQzm8UWibZIotdx8CIKqO4U/s400/2.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5510616216010614546&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 242px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;PDF do Relatório:&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOdGP_QWGmbWKMgHaLN53Sf_n9se2cTG9yjJdlV1bIwMPJBhHJ7CaeX2xML0Lwu0pxjY8IokSBEUhTsrnOWiPqbY_DEvzwWTBN_M_t7qbZmBXQMYwb5HjdM-9-Uy18EnJy-pe8Zv5hJGz8/s1600/3.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOdGP_QWGmbWKMgHaLN53Sf_n9se2cTG9yjJdlV1bIwMPJBhHJ7CaeX2xML0Lwu0pxjY8IokSBEUhTsrnOWiPqbY_DEvzwWTBN_M_t7qbZmBXQMYwb5HjdM-9-Uy18EnJy-pe8Zv5hJGz8/s400/3.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5510617419838172658&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 241px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: arial, verdana, serif; font-size: 14px; line-height: 22px; &quot;&gt;&lt;div style=&quot;text-align: justify; &quot;&gt;Bom galera, este foi um exemplo de como criar relatórios em Java, usando o JasperReport e o iReport,&lt;/div&gt;&lt;div style=&quot;text-align: justify; &quot;&gt;Para quem quiser baixar o exemplo, &lt;a href=&quot;http://www.4shared.com/file/V9RxcsdB/relatorio.html&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; &gt;clique aqui&lt;/span&gt;&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;text-align: justify; &quot;&gt;Qualquer dúvida, crítica ou sugestão, fico à disposição.&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/5574982309732628353/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/08/exemplo-de-relatorio-em-java-para-web.html#comment-form' title='5 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/5574982309732628353'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/5574982309732628353'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/08/exemplo-de-relatorio-em-java-para-web.html' title='Exemplo de Relatório em Java para web'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIkYh7EcpYd7xJy1YXAd-EXU14VYwN5e6zrOtpEjm3ad78yKS2_QQJnzZthjwjfKIuaUi8scDoGxr_UX1pgp1dzm5rjjGxQP5L9hC9TjKPgnMDXJHPFiv1bsI7Y8z4JeBZyZonlsk4e7E-/s72-c/4.png" height="72" width="72"/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-8423253858344018239</id><published>2010-07-30T16:22:00.000-07:00</published><updated>2010-07-30T16:22:00.542-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="Facelets"/><category scheme="http://www.blogger.com/atom/ns#" term="JBoss"/><category scheme="http://www.blogger.com/atom/ns#" term="JSF"/><title type='text'>Exemplo de Facelets com Eclipse e JBoss</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Neste post, irei mostrar um exemplo de como desenvolver aplicações web usando o Framework de template Facelets que é facilmente integrado no JSF. O Facelets oferece alguns vantagens:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Facilidade na criação de templates;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Elimina o &quot;JSP Compiler to Servlet&quot; incrementando de 30% a 50% a performance da aplicação;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Facilidade para criar componentes reutilizáveis;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Usa XHTML como tecnologia de view do JSF;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Precisão para reportar erros.&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Quando se desenvolve aplicações em JSF, é recomendável o uso Facelets, em vez de usar include nas subview no JSF.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;O exemplo a ser mostrado será desenvolvido usando JSF 1.2,  IDE Eclipse e o servidor JBoss.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Antes de começar, precisamos baixar o Facelets, acesse o site: https://www.dev.java.net/files/documents/3448/99102/facelets-1.1.15.B1.zip, recomendo a usar a versão 1.1.15 no JBoss, depois de baixar, descompacta o arquivo e copia os seguintes jar:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;el-api-1.0.jar&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;el-impl-1.0.jar&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;jsf-facelets.jar&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Cole este jars no seguinte diretório do JBoss:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;jboss-4.2.3.GA/server/default/deploy/jboss-web.deployer/jsf-libs/&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Precisamos baixar apenas o Facelets, as bibliotecas do JSF não precisa baixar, pois no diretório jsf-libs do JBoss, já contêm as bibliotecas do JSF.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;A versão do &lt;a href=&quot;http://sourceforge.net/projects/jboss/files/JBoss/JBoss-4.2.3.GA&quot;&gt;JBoss&lt;/a&gt; que estou usando é 4.2.3.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Ao final do post, o projeto será disponibilizado para download, para quem quiser baixar.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;O projeto final terá um layout de acordo com a imagem abaixo:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRf1JcL9zlEEFoSWp9bS0hfU5xUaXgmdicQlMrV8-cV6M16tqfk-cQ6Dr7nx47-ao5H6xWNDdOJKqy5XppnNVDKuBzVw7hDIx2S81moHMwi-Mjz_40m9oawcTciDMYuwBhNv5JWxu_rLc1/s1600/2.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRf1JcL9zlEEFoSWp9bS0hfU5xUaXgmdicQlMrV8-cV6M16tqfk-cQ6Dr7nx47-ao5H6xWNDdOJKqy5XppnNVDKuBzVw7hDIx2S81moHMwi-Mjz_40m9oawcTciDMYuwBhNv5JWxu_rLc1/s400/2.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5489106183625504610&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 260px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. Passo: Estrutura do projeto web:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqr0WP9bilfwv9-o5kLZ7lJBlbzzGVqagu9b5HTTs1W9R_Cn5V1OwAid6FdzXJK9ajrdvG7oRvxhuCqXgCn8SA674UPZD5KttaE5szS37QaiIug-5ETIggnigdaFWvyizO1zaj4z9ysNvA/s1600/1.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqr0WP9bilfwv9-o5kLZ7lJBlbzzGVqagu9b5HTTs1W9R_Cn5V1OwAid6FdzXJK9ajrdvG7oRvxhuCqXgCn8SA674UPZD5KttaE5szS37QaiIug-5ETIggnigdaFWvyizO1zaj4z9ysNvA/s400/1.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5489089490556401666&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 307px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2. Passo: Antes de começar a criar as páginas é necessário fazer algumas configurações tanto no arquivo web.xml quanto no faces-config.xml, primeiro iremos configurar o arquivo web.xml, adicionando alguns parâmetros de contexto.&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;web-app version=&quot;2.5&quot; xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;                       http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd&quot;&amp;gt;&lt;/div&gt;&lt;div&gt;                       &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;display-name&amp;gt;facelets&amp;lt;/display-name&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;!-- Use Documents Saved as *.xhtml --&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;context-param&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;param-name&amp;gt;javax.faces.DEFAULT_SUFFIX&amp;lt;/param-name&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;param-value&amp;gt;.xhtml&amp;lt;/param-value&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/context-param&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;!-- Special Debug Output for Development --&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;context-param&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;param-name&amp;gt;facelets.DEVELOPMENT&amp;lt;/param-name&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/context-param&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;!-- Optional JSF-RI Parameters to Help Debug --&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;context-param&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;param-name&amp;gt;com.sun.faces.validateXml&amp;lt;/param-name&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/context-param&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;context-param&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;param-name&amp;gt;com.sun.faces.verifyObjects&amp;lt;/param-name&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;param-value&amp;gt;true&amp;lt;/param-value&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/context-param&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;!-- Servlet JSF --&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;servlet&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-name&amp;gt;javax.faces.FacesServlet&amp;lt;/servlet-name&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-class&amp;gt;javax.faces.webapp.FacesServlet&amp;lt;/servlet-class&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/servlet&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;servlet-mapping&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;servlet-name&amp;gt;javax.faces.FacesServlet&amp;lt;/servlet-name&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;url-pattern&amp;gt;*.faces&amp;lt;/url-pattern&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/servlet-mapping&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;welcome-file-list&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;welcome-file&amp;gt;index.jsp&amp;lt;/welcome-file&amp;gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/welcome-file-list&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/web-app&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;web.xml&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Agora vamos adicionar o FaceletViewHandler no arquivo faces-config.xml&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;faces-config xmlns=&quot;http://java.sun.com/xml/ns/javaee&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xsi:schemaLocation=&quot;http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;version=&quot;1.2&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;application&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;!-- Facelets --&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;view-handler&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;com.sun.facelets.FaceletViewHandler&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;/view-handler&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/application&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/faces-config&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;faces-config.xml&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;3. Passo:  Agora vamos criar as páginas para ser usadas no Facelets, do tipo .xhtml, para criar com estas extensões no Eclipse, basta criar um novo arquivo file e colocar o nome + a extensão .xhtml.&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:ui=&quot;http://java.sun.com/jsf/facelets&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:h=&quot;http://java.sun.com/jsf/html&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:f=&quot;http://java.sun.com/jsf/core&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;head&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;title&amp;gt;Facelets com Eclipse e JBoss Application Server&amp;lt;/title&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;link href=&quot;css.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/head&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;body&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;div id=&quot;tudo&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;div id=&quot;topo&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;ui:insert name=&quot;topo&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;ui:include src=&quot;topo.xhtml&quot; /&amp;gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;/ui:insert&amp;gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;div id=&quot;centro&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;div id=&quot;menu&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;ui:insert name=&quot;menu&quot;&amp;gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;    &lt;/span&gt;&amp;lt;ui:include src=&quot;menu.xhtml&quot; /&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;/ui:insert&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;div id=&quot;principal&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;ui:insert name=&quot;principal&quot;&amp;gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;/ui:insert&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;div id=&quot;rodape&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;ui:insert name=&quot;rodape&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;ui:include src=&quot;rodape.xhtml&quot; /&amp;gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;/ui:insert&amp;gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/div&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/body&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/html&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;template.xhtml&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;No código acima, temos algumas tags do Facelets, o ui:insert serve para definirmos um ponto de substituição no template, o ui:include serve para incluir um fragmento.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Agora vamor criar as páginas de fragmentos.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Página topo:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;ui:fragment xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:ui=&quot;http://java.sun.com/jsf/facelets&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:h=&quot;http://java.sun.com/jsf/html&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:f=&quot;http://java.sun.com/jsf/core&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;TOPO&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/ui:fragment&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;topo.xhtml&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;A tag ui.fragment é usada para definir um bloco de conteúdo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Página de menu:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;ui:fragment xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:ui=&quot;http://java.sun.com/jsf/facelets&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:h=&quot;http://java.sun.com/jsf/html&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:f=&quot;http://java.sun.com/jsf/core&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;h:form&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;ul&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;li&amp;gt;&amp;lt;h:outputLink value=&quot;index.faces&quot;&amp;gt;LINK1&amp;lt;/h:outputLink&amp;gt;&amp;lt;/li&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;li&amp;gt;&amp;lt;h:outputLink value=&quot;index.faces&quot;&amp;gt;LINK2&amp;lt;/h:outputLink&amp;gt;&amp;lt;/li&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;li&amp;gt;&amp;lt;h:outputLink value=&quot;index.faces&quot;&amp;gt;LINK3&amp;lt;/h:outputLink&amp;gt;&amp;lt;/li&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;&amp;lt;li&amp;gt;&amp;lt;h:outputLink value=&quot;index.faces&quot;&amp;gt;LINK4&amp;lt;/h:outputLink&amp;gt;&amp;lt;/li&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;/ul&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/h:form&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/ui:fragment&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;menu.xhtml&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Página do rodapé:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;ui:fragment xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:ui=&quot;http://java.sun.com/jsf/facelets&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:h=&quot;http://java.sun.com/jsf/html&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:f=&quot;http://java.sun.com/jsf/core&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;RODAPE&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/ui:fragment&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;rodape.xhtml&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Agora vamos criar uma página que irá fazer o relacionamento de composição com o template.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Página index do Facelets:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:ui=&quot;http://java.sun.com/jsf/facelets&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:h=&quot;http://java.sun.com/jsf/html&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;xmlns:f=&quot;http://java.sun.com/jsf/core&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;ui:composition template=&quot;/template.xhtml&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;ui:define name=&quot;principal&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;h1&amp;gt;&amp;lt;h:outputText value=&quot;Exemplo de Facelets usando Eclipse e JBoss Application Server&quot; /&amp;gt;&amp;lt;/h1&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&amp;lt;h:outputText value=&quot;Àrea para o conteúdo principal.&quot; /&amp;gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;/ui:define&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/ui:composition&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/html&amp;gt;&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;index.xhtml&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;A tag ui:composition serve para definir o relacionamento de composição entre esta tela e o template, a tag ui:define serve para substituir a definição da tag ui:insert, nesta tela a única parte que está sendo sobrepondo é a àrea principal.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Crie uma página index.jsp para abertura da aplicação:&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;jsp:forward page=&quot;index.faces&quot; /&amp;gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;index.jsp&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Arquivo css para definir a estrutura e aparência do projeto&lt;/div&gt;&lt;div&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;* {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;padding: 0;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;margin: 0;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;font-size: 12pt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;ul {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;list-style: none;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;body {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;text-align: center;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;#tudo {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;width: 800px;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;margin: 0 auto;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;#topo {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;width: 100%;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;height: 80px;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;float: left;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;border: 2px solid;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;margin-top: 0.5em;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;background: red;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;#centro {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;width: 100%;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;height: 300px;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;float: left;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;margin-top: 0.5em;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;#menu {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;width: 20%;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;height: 100%;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;float: left;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;overflow: auto;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;border: 2px solid;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;background: yellow;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;#menu li{&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;display: block;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;text-align: center;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;#principal {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;width: 78%;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;height: 100%;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;float: right;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;overflow: auto;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;border: 2px solid;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;background: silver;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;#rodape {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;width: 100%;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;height: 30px;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;float: left;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;border: 2px solid;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;margin-top: 0.5em;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;background: lime;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;}&lt;/div&gt;&lt;/div&gt;&lt;/code&gt;&lt;div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;css.css&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Bom galera, este foi um exemplo de como usar o Facelets nas aplicações JSF, &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para quem quiser baixar o exemplo, &lt;a href=&quot;http://www.4shared.com/file/Rpd3fcIC/facelets.html&quot;&gt;clique aqui&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Qualquer dúvida, crítica ou sugestão, fico à disposição.&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/8423253858344018239/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/07/exemplo-de-facelets-com-eclipse-e-jboss.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/8423253858344018239'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/8423253858344018239'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/07/exemplo-de-facelets-com-eclipse-e-jboss.html' title='Exemplo de Facelets com Eclipse e JBoss'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjRf1JcL9zlEEFoSWp9bS0hfU5xUaXgmdicQlMrV8-cV6M16tqfk-cQ6Dr7nx47-ao5H6xWNDdOJKqy5XppnNVDKuBzVw7hDIx2S81moHMwi-Mjz_40m9oawcTciDMYuwBhNv5JWxu_rLc1/s72-c/2.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-7427704771978089990</id><published>2010-07-05T12:00:00.000-07:00</published><updated>2010-07-05T12:00:03.156-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="JBoss"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Configurando Ambiente JEE no Linux (Ubuntu + Java + Eclipse + JBoss App Server)</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Neste post irei mostrar como configurar um ambiente JEE no Ubuntu 10.04, as etapas são muito simples, começaremos com o download do Java, Eclipse e jBoss4, e por fim, vamos fazer um teste com um HelloWorld. =)&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. Passo: Instalação do Java por apt-get, abre uma janela do terminal e digite o seguinte comando:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;sudo apt-get install sun-java6-jre sun-java6-jdk sun-java6-plugin&lt;/div&gt;&lt;/code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Após a instalação, vamos configurar as variáveis de ambiente, com o terminal aberto, digite o comando:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;sudo gedit /etc/profile&lt;/div&gt;&lt;/code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Após abrir o arquivo, vai até o final do conteúdo e acrescenta:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.20&lt;/div&gt;&lt;/code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para ver qual a versão do Java que você está usando, digite o comando:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;java -version&lt;/div&gt;&lt;/code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Esta versão deve ser informada no JAVA_HOME.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Agora renicie o computador.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2. Passo: Vamos baixar o Eclipse, entre no site http://www.eclipse.org/downloads/, escolha a plataforma Linux e baixe o Eclipse IDE for Java EE Developers, após ter baixado, descompacte em uma pasta de sua preferência.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;3. Passo: Vamos baixar o JBoss Application Server, entre no site: http://www.jboss.org/jbossas/downloads/, neste exemplo estou usando a versão 4.2.3, após ter baixado, descompacte em uma pasta de sua preferência.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Vamos configurar o JBOSS_HOME, abre o terminal e digite o comando:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;sudo gedit /etc/profile&lt;/div&gt;&lt;/code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Após abrir o arquivo, vai até o final do conteúdo e acrescenta o JBOSS_HOME, e o diretório onde você colocou o JBoss:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;export JBOSS_HOME=&quot;/media/dados/java/jboss4/jboss-4.2.3.GA/&quot;&lt;/div&gt;&lt;/code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;No exemplo acima, substituir o caminho do diretório e a versão do JBoss de acordo com a que você está usando.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;4. Passo: Agora vamos configurar o JBoss Application Server no Eclipse, abre seu Eclipse, escolha o diretório do seu workspace, com o Eclipse aberto vamos configurar server:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Selecione a guia Servers, clique com o botão direito do mouse e escolha New -&gt; Server.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Na janela que abrir, escolha jBoss e selecione a versão 4.2, e clique em Next.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Na próxima janela, clique em Browse e escolha o diretório onde o seu JBoss está, depois clique em Finish.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;5. Passo: Para testar nosso ambiente, vamos executar um exemplo simples de Servlet.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Criando o projeto, vai no menu file -&gt; New -&gt; Dynamic Web Project.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Na janela que abrir informe o nome do projeto: HelloWorldWeb, em Target runtime, escolha o jBoss, clique em Finish.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Crie um Servlet: HelloServlet&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import java.io.IOException;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import java.io.PrintWriter;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import javax.servlet.ServletException;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import javax.servlet.http.HttpServlet;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import javax.servlet.http.HttpServletRequest;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;import javax.servlet.http.HttpServletResponse;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;public class HelloServlet extends HttpServlet {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;private static final long serialVersionUID = 1L;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public HelloServlet() {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;super();&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;public void processRequest(HttpServletRequest request,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;HttpServletResponse response) throws ServletException, IOException {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;        PrintWriter out = response.getWriter();        &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;        out.println(&quot;HelloServlet com Eclipse e JBoss Application Server&quot;);            &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;protected void doGet(HttpServletRequest request,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;HttpServletResponse response) throws ServletException, IOException {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;processRequest(request, response);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;protected void doPost(HttpServletRequest request,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;   &lt;/span&gt;HttpServletResponse response) throws ServletException, IOException {&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt;  &lt;/span&gt;processRequest(request, response);&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;}&lt;/div&gt;&lt;/code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Crie um arquivo index.jsp&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;/code&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;%@ page language=&quot;java&quot; contentType=&quot;text/html; charset=UTF-8&quot;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;    pageEncoding=&quot;UTF-8&quot;%&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot; &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;html&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;head&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=UTF-8&quot;&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;title&amp;gt;Ubuntu + Eclipse + JBoss Application Server&amp;lt;/title&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/head&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;body&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;&amp;lt;a href=&quot;./HelloServlet&quot;&amp;gt;Chamar Servlet&amp;lt;/a&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/body&amp;gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&amp;lt;/html&amp;gt;&lt;/div&gt;&lt;/code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Agora clique com o botão direito do mouse sobre o projeto:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Debug As -&gt; Run on Server.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Na janela que abrir clique em Finish.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;O JBoss será inicializado e já irá fazer o deploy do projeto.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Testando: http://localhost:8080/HelloWorldWeb&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Bom pessoal, este foi um exemplo de como montar um ambiente JEE, totalmente gratuito e com as melhores ferramentas do mercado.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Qualquer dúvida, crítica ou sugestão, fico à disposição.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/7427704771978089990/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/07/configurando-ambiente-jee-no-linux.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/7427704771978089990'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/7427704771978089990'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/07/configurando-ambiente-jee-no-linux.html' title='Configurando Ambiente JEE no Linux (Ubuntu + Java + Eclipse + JBoss App Server)'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-8441674613503950149</id><published>2010-06-26T14:37:00.000-07:00</published><updated>2010-06-26T20:45:28.826-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><title type='text'>Compilador JAVA online</title><content type='html'>Olá Pessoal,&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Achei um site muito legal que oferece um serviço para compilar códigos fontes Java, quem quiser conferir, acesse: &lt;a href=&quot;http://www.innovation.ch/java/java_compile.html&quot; target=&quot;_blank&quot;&gt;http://www.innovation.ch/java/java_compile.html&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/8441674613503950149/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/06/compilador-java-online.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/8441674613503950149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/8441674613503950149'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/06/compilador-java-online.html' title='Compilador JAVA online'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-27024037157422702</id><published>2010-05-30T00:11:00.000-07:00</published><updated>2010-06-26T20:45:41.851-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AJAX"/><category scheme="http://www.blogger.com/atom/ns#" term="GlassFish"/><category scheme="http://www.blogger.com/atom/ns#" term="JSF"/><category scheme="http://www.blogger.com/atom/ns#" term="Netbeans"/><title type='text'>Exemplo de JSF2 com AJAX</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;O framework JavaServer Faces em sua  penúltima versão (1.2) nos permite obter várias vantagens para o desenvolvimento de aplicações, como por exemplo a produtividade, entretanto o JSF padrão é um pouco limitado, e para obter uma gama maiores de componentes, suporte a AJAX, e etc... É recomendado utilizar um framework que implementa o JSF, como por exemplo: IceFaces, RichFaces, entre outros.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;O AJAX é um conjunto de tecnologia que é bastante utilizada no desenvolvimento web, permitindo que utilizem-se de solicitações assíncronas de informações. O JSF 2 já possui o suporte a AJAX, e neste post veremos um exemplo simples, de como implementar o AJAX em nossas aplicações.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;O objetivo é apenas mostrar o funcionamento do AJAX, po isso, em nossa aplicação teremos um campo texto, que será usado para informar o nome de uma pessoa, quando é digitado o nome, usaremos o evento keyup, para mostrar a quantidade de caracteres que está sendo digitado, também temos um botão de ação, que quando invocado será usado para exibir o nome digitado e a quantidade de caracteres que esse nome possui, por fim, quando o campo texto ganhar o foco, todos as informações contidas na tela serão limpadas.&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;O exemplo foi desenvolvido utilizando a IDE Netbeans 6.8 e o servidor Glassfish.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Ao final do post, o projeto será disponibilizado para download, para quem quiser baixar e testar.&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. Passo: Veja como é a estrutura do projeto:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglw4NTpwgA2g8pASrCD8jict-yWKD22t26m_L82cu0x-5T4A4kWqcMcygKOOdmzPNtx3xTTOz9df_Q81JVTjaVjYxRAO9Rfpw2x8g51op9tu6y0jhyacx31z6vGk1pS9swJI2xMqJjLrk_/s1600/1.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglw4NTpwgA2g8pASrCD8jict-yWKD22t26m_L82cu0x-5T4A4kWqcMcygKOOdmzPNtx3xTTOz9df_Q81JVTjaVjYxRAO9Rfpw2x8g51op9tu6y0jhyacx31z6vGk1pS9swJI2xMqJjLrk_/s400/1.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5476966888859337682&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 380px; height: 287px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2. Passo: Iremos criar a Classe PessoaMB, no pacote managedbean, esta Classe possui 2 atributos nome e mensagem, com seus respectivos métodos get e set, mais 3 métodos teremos, um que é chamado no evento blur para limpar os valores dos atributos da Classe, os outros métodos é para mostrar a quatidade de caracteres que estão sendo digitados, esse método será invocado do evento keyup, e método para mostrar o nome digitado, que é invocado no evento click do botão.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYYBNVhPNHMFWHeaTq5XdQImgPXS_xnNsg43WYnpy8q3iOmsWoGN_FLZ2BMrhxCRvodDNTpjeg1voXCqlcNGHJdbbT0JYHJH2yxbu8YJDpWnaJm6HOtBNSgc1878FEyjzt-RdUm25b1dTI/s1600/2.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgYYBNVhPNHMFWHeaTq5XdQImgPXS_xnNsg43WYnpy8q3iOmsWoGN_FLZ2BMrhxCRvodDNTpjeg1voXCqlcNGHJdbbT0JYHJH2yxbu8YJDpWnaJm6HOtBNSgc1878FEyjzt-RdUm25b1dTI/s400/2.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5476968352216206210&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 285px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;3. Passo: O próximo passo é criar a página, a grande novidade nessa página é o uso da tag f:ajax, no uso dela através do campo texto, temos 3 atributos, o event que é usado para escolher qual evento javascript será utilizado, o atributo render é usado para mostrar novamente  o renderizamento da resposta, o valor desse atributo é o id do output que será usado para mostrar a mensagem, observe que podemos renderizar mais de componente ao mesmo, bastando separar-lôs entre espaço, e o atributo listener faz a ligação com um método comum que está na classe PessoaMB, o uso da tag f:ajax no botão está com um atributo execute que é utilizado para informar o que será enviado para o servidor na requisição AJAX.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3biaBNp8_puPzwAOOFSUf_5q_p-SvH_ra8pyeqTYo3mVS8qZsyzRX1VW-CsyE_-SUkHyVP5swdlU5pZRpSUPHZ_sK7f3JCNJgcIPw0e5dhbLD0qwmGBPzlNe-TC08ad6PJ8k-uNaGayca/s1600/3.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3biaBNp8_puPzwAOOFSUf_5q_p-SvH_ra8pyeqTYo3mVS8qZsyzRX1VW-CsyE_-SUkHyVP5swdlU5pZRpSUPHZ_sK7f3JCNJgcIPw0e5dhbLD0qwmGBPzlNe-TC08ad6PJ8k-uNaGayca/s400/3.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5476971724774241154&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 190px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;4. Passo: Agora é executar e testar o exemplo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsI6yPueMDl_RvdlCpFFfS4OK1KLZEsLI_bHBeSqo_xZRZuYGsts6KbRLtPeUpvJN_QsllrxUfdi_ugwAZjrswb7K3Gt5x8JKnAxyCXVD0NbNdbXXeBh6i73lQVlAd5bHOS9x7yV06gP2I/s1600/4.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsI6yPueMDl_RvdlCpFFfS4OK1KLZEsLI_bHBeSqo_xZRZuYGsts6KbRLtPeUpvJN_QsllrxUfdi_ugwAZjrswb7K3Gt5x8JKnAxyCXVD0NbNdbXXeBh6i73lQVlAd5bHOS9x7yV06gP2I/s400/4.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5476972117440504770&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 203px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQtZU_EJ9N87GkieN8Dp413i8E66G40S9uqO9vHVhSd5-59Y677aiBeqespiotnCMO5qyfxQoU0l_FbgcPoqZIp8pSvMttGC5wp3kKtJuOKd83OMQ_qp3TF3VZl57QdNrDRD3V6SCSOzow/s1600/5.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQtZU_EJ9N87GkieN8Dp413i8E66G40S9uqO9vHVhSd5-59Y677aiBeqespiotnCMO5qyfxQoU0l_FbgcPoqZIp8pSvMttGC5wp3kKtJuOKd83OMQ_qp3TF3VZl57QdNrDRD3V6SCSOzow/s400/5.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5476972124326842450&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 206px; &quot; /&gt;&lt;/a&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Bom pessoal, este foi um exemplo simples de AJAX usando o JSF2, esse exemplo poderia ser feito só em javascript, mas a intenção do post foi mostrar como é implementado o AJAX no JavaServer Faces.&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para quem quiser baixar o exemplo, &lt;a href=&quot;http://www.4shared.com/file/JBHIZyyi/ExemploJSF2AJAX.html&quot; target=&quot;blank&quot;&gt;clique aqui&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Qualquer dúvida, crítica ou sugestão, fico à disposição.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/27024037157422702/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/05/exemplo-de-jsf2-com-ajax.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/27024037157422702'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/27024037157422702'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/05/exemplo-de-jsf2-com-ajax.html' title='Exemplo de JSF2 com AJAX'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglw4NTpwgA2g8pASrCD8jict-yWKD22t26m_L82cu0x-5T4A4kWqcMcygKOOdmzPNtx3xTTOz9df_Q81JVTjaVjYxRAO9Rfpw2x8g51op9tu6y0jhyacx31z6vGk1pS9swJI2xMqJjLrk_/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-9066660064959139420</id><published>2010-04-24T10:18:00.000-07:00</published><updated>2010-06-26T20:46:00.086-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="JSF"/><category scheme="http://www.blogger.com/atom/ns#" term="TomCat"/><title type='text'>Customizar/Personalizar Validador em JSF</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;O Framework JavaServer Faces oferece alguns validadores já prontos para serem usados, como por exemplo: validar o tamanho máximo ou mínimo de uma String ou validar somente campos numéricos, entretanto esses  validadores são limitado. Para contornar este problema, o JSF nos permite que sejam desenvolvidos validadores customizados/personalizados de acordo com a regra de negócio.&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Neste post, irei mostrar um exemplo de validador customizado que serve para validar o CPF, é um exemplo bem simples, mais o foco é mostrar como que implementa este recurso no JSF.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;O exemplo foi desenvolvido utilizando a IDE Eclipse e o servidor TomCat.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Ao final do post, o projeto será disponibilizado para download, para quem quiser baixar e testar.&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. Passo: Estrutura do projeto:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjn8d0XQeeuLar_CMv6Ki312Q4J6Wzg3Ook9CV4UkHXnyTmyLOh14Abz4W8dL4zvyR2xhOFCYyOng1DC8fH0ZeJTvWxq7nDlvS_Zh8D1NUzfQohj0TAjocYGhyphenhyphenJm9RWMXjRj2QXClcTj2Tn/s1600/1.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjn8d0XQeeuLar_CMv6Ki312Q4J6Wzg3Ook9CV4UkHXnyTmyLOh14Abz4W8dL4zvyR2xhOFCYyOng1DC8fH0ZeJTvWxq7nDlvS_Zh8D1NUzfQohj0TAjocYGhyphenhyphenJm9RWMXjRj2QXClcTj2Tn/s400/1.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463758404409834098&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 315px; height: 313px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2. Passo: Estrutura do arquivo web.xml:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDcA8kFu2G5Y8mPByb4lsmtivT0AwX59wekEohDHMov37UkwiGP_qDRQDE5_U1QArCjei-7DoTrr1GjlyNhVCTRgtHADYRaJGWTAyiB5d2vurFMUUbAP9JNJBUsaL_gBkrYqjvEDgwNOOs/s1600/2.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgDcA8kFu2G5Y8mPByb4lsmtivT0AwX59wekEohDHMov37UkwiGP_qDRQDE5_U1QArCjei-7DoTrr1GjlyNhVCTRgtHADYRaJGWTAyiB5d2vurFMUUbAP9JNJBUsaL_gBkrYqjvEDgwNOOs/s400/2.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463758877327492146&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 211px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;3. Passo: Crie a Classe ManagedBean chamado de ValidaCPF no pacote managedbean, esta classe contém o atributo cpf com seu método get e set, o método validador do JSF, e um método que verifica se o CPF digitado é valido. A classe ficará de acordo com a imagem abaixo:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhx-oe3Yb8h3a0yjjEwJhfRARnpn1A8ZL9JlMPb90yB9wcweurX-vrFAM9t3ZD_891FJhunrma_VUneq8dd_r9G7-3VxfQCABJ6Nl06NuHyGrMRQP_-fP52nDuqCzC5wti7pXrKVvUJiKDe/s1600/3.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhx-oe3Yb8h3a0yjjEwJhfRARnpn1A8ZL9JlMPb90yB9wcweurX-vrFAM9t3ZD_891FJhunrma_VUneq8dd_r9G7-3VxfQCABJ6Nl06NuHyGrMRQP_-fP52nDuqCzC5wti7pXrKVvUJiKDe/s400/3.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463760408854156194&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 346px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;4. Passo: Estrutura do arquivo faces-config.xml:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXoDsDvb5f-B6CWgutpYE2ZuCyVAyNGlSRRYk0mhyATZusSbbDBkINxdg9wnlOEuInYeb42HgIctx6cYLB1LXmfoKvhImABow-mgqHcAv4mxyo-B6qmFfGzPHdqhSWF-9N-WEVq5WDoj1K/s1600/4.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXoDsDvb5f-B6CWgutpYE2ZuCyVAyNGlSRRYk0mhyATZusSbbDBkINxdg9wnlOEuInYeb42HgIctx6cYLB1LXmfoKvhImABow-mgqHcAv4mxyo-B6qmFfGzPHdqhSWF-9N-WEVq5WDoj1K/s400/4.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463760672832418738&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 244px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;5. Passo: Crie a página index.jsp, que conterá o formulário para digitar o CPF, de acordo com a imagem abaixo:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHwnsRsHWKAdKVRY8bvim7ZoOO7LH5rQP9jyMsivEbMmY6bq899F18VTaDmBfKN39L4dWibtsrV52rTF-vAdRuW4NeBzKxOQomv2STEtlcp8mbdHgmC3BCNdkXk5kkMmiMTbU9D9Ia9WtL/s1600/5.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHwnsRsHWKAdKVRY8bvim7ZoOO7LH5rQP9jyMsivEbMmY6bq899F18VTaDmBfKN39L4dWibtsrV52rTF-vAdRuW4NeBzKxOQomv2STEtlcp8mbdHgmC3BCNdkXk5kkMmiMTbU9D9Ia9WtL/s400/5.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463761318804420562&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 292px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;6. Passo: Crie uma página redirect.jsp, para redirecionar para o nosso formulário, nessa página basta acrescentar: &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHsDnfkd03GWmI4y_Llt_QEwDCQRaOZuBrklu7vOiWpA5ZYxumDfcom5k_qvgnfKmyI-bL2Jw1edBVbvmiF93NykR5t0Yg-EPm0nT93roP4fzam4aytHXy89SkbXw_91GZrlF30hc4aexX/s1600/9.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHsDnfkd03GWmI4y_Llt_QEwDCQRaOZuBrklu7vOiWpA5ZYxumDfcom5k_qvgnfKmyI-bL2Jw1edBVbvmiF93NykR5t0Yg-EPm0nT93roP4fzam4aytHXy89SkbXw_91GZrlF30hc4aexX/s400/9.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463764726663603122&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 354px; height: 114px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;7. Passo: Executa o projeto, e verá a seguinte página:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiGTlm41g6bvmGdA3JvWVKFArtFuo63klHvnguKqSE3W1jjr_QVgpN4WabT102HFwGJdG6ppW2TJM1RNgaXLN2DfqHP3vqQC2oFshBedzPk57lA4LECIj1pQQ69JzGDddotv0xm_9Svzu9/s1600/6.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiGTlm41g6bvmGdA3JvWVKFArtFuo63klHvnguKqSE3W1jjr_QVgpN4WabT102HFwGJdG6ppW2TJM1RNgaXLN2DfqHP3vqQC2oFshBedzPk57lA4LECIj1pQQ69JzGDddotv0xm_9Svzu9/s400/6.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463762020528115458&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 207px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;8. Passo: Vamos testar, digitando um CPF inválido:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEissTV2Vh8SxwsaGslZGkQNV94cwWbQ9rsGVSq-q4-Aa1eEo6aW-FHxtDYyVrpzAbwbWfLsEvlom3wM6hl8KPx7CrHq_UW4srXLwZBD5RkO99wVGSpzMzEh7XKf3eyJKfP5LTPLXW1xN4TY/s1600/7.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEissTV2Vh8SxwsaGslZGkQNV94cwWbQ9rsGVSq-q4-Aa1eEo6aW-FHxtDYyVrpzAbwbWfLsEvlom3wM6hl8KPx7CrHq_UW4srXLwZBD5RkO99wVGSpzMzEh7XKf3eyJKfP5LTPLXW1xN4TY/s400/7.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463762238374678290&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 226px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;9. Passo: Vamos testar, digitando um CPF válido:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj978YVfzjN-3bXrhUvULKNS9Gs5KPJFWW0Jk0LYeXIdXqaZCIvBZ-CBzAe2KiS1-PyrmF_5aWi-GmNzwMbUQyPwJlxtaqXXBAKlbEOv8uYpkTepZck92smsiS4yMI-zax3sSEstOoaipDs/s1600/8.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj978YVfzjN-3bXrhUvULKNS9Gs5KPJFWW0Jk0LYeXIdXqaZCIvBZ-CBzAe2KiS1-PyrmF_5aWi-GmNzwMbUQyPwJlxtaqXXBAKlbEOv8uYpkTepZck92smsiS4yMI-zax3sSEstOoaipDs/s400/8.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463762450665354386&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 235px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Bom galera, este foi um exemplo bem básico de como personalizar validadores no JSF. &lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para quem quiser baixar o exemplo, &lt;a href=&quot;http://www.4shared.com/file/AqP4EcQJ/validador-jsf.html&quot; target=&quot;_bank&quot;&gt;clique aqui&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Qualquer dúvida, crítica ou sugestão, fico à disposição.&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/9066660064959139420/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/04/validador-customizadopersonalizado-em.html#comment-form' title='1 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/9066660064959139420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/9066660064959139420'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/04/validador-customizadopersonalizado-em.html' title='Customizar/Personalizar Validador em JSF'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjn8d0XQeeuLar_CMv6Ki312Q4J6Wzg3Ook9CV4UkHXnyTmyLOh14Abz4W8dL4zvyR2xhOFCYyOng1DC8fH0ZeJTvWxq7nDlvS_Zh8D1NUzfQohj0TAjocYGhyphenhyphenJm9RWMXjRj2QXClcTj2Tn/s72-c/1.png" height="72" width="72"/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-1770511487585623480</id><published>2010-04-10T11:48:00.000-07:00</published><updated>2010-04-16T14:05:10.217-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="JSF"/><category scheme="http://www.blogger.com/atom/ns#" term="TomCat"/><title type='text'>Internacionalização com JSF</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Um dos recursos que o Framework JavaServer Faces (JSF) oferece, é a internacionalização da aplicação, possibilitando que a mesma tenha vários idiomas.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Neste post irei mostrar um exemplo, utilizando os idiomas: (Português, Inglês, Alemão, Italiano e Francês), é uma pequena aplicação, mas pode ser tomada com base para desenvolver qualquer tipo projeto.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;O exemplo foi desenvolvido utilizando a IDE Eclipse e o servidor TomCat.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Ao final do post, o projeto será disponibilizado para download, para quem quiser baixar e testar.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. Passo: A aplicação foi estruturada de acordo com a imagem:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgitXcMbBbOAsB5O_1a5VzCEQ7hQ4g3q18yAgHvJkualPQkeWnWC_0lk-QPkd17vIp_WETyXXjCUp9_pMB4G76zXWFwnhvexc8Rl5tsdC-irIH6TKOry-6VtLm6leLuQ4ETUDR-Kqg1Doon/s1600/1.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgitXcMbBbOAsB5O_1a5VzCEQ7hQ4g3q18yAgHvJkualPQkeWnWC_0lk-QPkd17vIp_WETyXXjCUp9_pMB4G76zXWFwnhvexc8Rl5tsdC-irIH6TKOry-6VtLm6leLuQ4ETUDR-Kqg1Doon/s400/1.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5458586903950082930&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 209px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2. Passo: A primeira coisa que iremos fazer, é criar o ManagedBean com o nome InternacionalizacaoMB dentro do pacote managedbean, esta Classe é bem simples, possui 2 atributos, a Linguagem (Locale) e o País, com seus metodos gets e sets, o método mudarIdioma() é envocado através da ação de um link,  nele é testado se o Locale possui um Pais, e logo é chamado o metodo mudarLocalidade() que altera o Locale, o ser retorno é null, ou seja, será redirecionado para ficar na mesma página.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1tg38GNAgnKDwa5TunOQkBAYD1sHfrDNd_losQnzDjvZwYvbbiex8tzG5xKFKL67lIg3xACMu-kZ8j3ZMepkHwjejZhbB0fF0VYSSV1rrxGaCvO1d1qzlUUx674_QWz22KihC8ZiDnv2Z/s1600/2.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1tg38GNAgnKDwa5TunOQkBAYD1sHfrDNd_losQnzDjvZwYvbbiex8tzG5xKFKL67lIg3xACMu-kZ8j3ZMepkHwjejZhbB0fF0VYSSV1rrxGaCvO1d1qzlUUx674_QWz22KihC8ZiDnv2Z/s400/2.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460835750935807394&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 387px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;3. Passo: Agora iremos criar os arquivos de propriedades que armazenarão os textos de cada idioma, cria um arquivo properties chamado mensagem, conforme a imagem abaixo:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvtjEZ4mm6bdm7zA36c8B0hXF6_O-pmljblX54HdOwfcz5b081M2OH4vzyXiGlVgeXOB0wuVtSdOGV8qocUyN2bJrEae4vPBXY7riiVGjBL7FjwIlGM2e3NpLsUc-PmG6Sc12s0dqrqKCi/s1600/3.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvtjEZ4mm6bdm7zA36c8B0hXF6_O-pmljblX54HdOwfcz5b081M2OH4vzyXiGlVgeXOB0wuVtSdOGV8qocUyN2bJrEae4vPBXY7riiVGjBL7FjwIlGM2e3NpLsUc-PmG6Sc12s0dqrqKCi/s400/3.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460835898281370130&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 243px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;4. Passo: Neste exemplo foram criados 6 arquivos de properties, em todos os arquivos as propriedade não podem ser alterados, apenas seus valores. Um arquivo com o idioma Inglês, ficará conforme a imagem:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfaLCAQUObA_rUHvwx-lvAil7Sk5kThEFN7rN1rv5BoSrB7l-s6uK1qU9OS3uCsCxPXam6i5mCwba7XwpvJ13NuV3HQS6ogNT0chPS8Li5lH_idYuf9nMMwQDLS2rWFAEwDwyMZ2RBKIgm/s1600/4.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfaLCAQUObA_rUHvwx-lvAil7Sk5kThEFN7rN1rv5BoSrB7l-s6uK1qU9OS3uCsCxPXam6i5mCwba7XwpvJ13NuV3HQS6ogNT0chPS8Li5lH_idYuf9nMMwQDLS2rWFAEwDwyMZ2RBKIgm/s400/4.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460836072297717314&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 196px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;5. Passo:  No nosso arquivo de configuração do JSF, o faces-config.xml, temos que configurar o managedbean, Locale e o arquivo properties, no Locale, informei apenas o idioma Português e Inglês, mas pode deve ser colocado os Locale dos idiomas Alemão, Francês e Italiano.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaGYggZDcD4_sxKeGd9bO35iko2HXzH2guB1zgd4QfTRnF4VbwLyAUbIe8bVRGzCWwmNQ3jn_v3oQJ1DLEw1xZVunhV3LZOBwcEzurW-udDE_NrUIWu0EJtPXT9qiJgz3UdhcTS8ivpORo/s1600/5.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaGYggZDcD4_sxKeGd9bO35iko2HXzH2guB1zgd4QfTRnF4VbwLyAUbIe8bVRGzCWwmNQ3jn_v3oQJ1DLEw1xZVunhV3LZOBwcEzurW-udDE_NrUIWu0EJtPXT9qiJgz3UdhcTS8ivpORo/s400/5.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460836231096041170&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 306px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;6. Passo: Configuração do arquivo web.xml:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwv8aWIHeCbC_WILxWINhHqS71z1yRJ28tXsy9CufpY5OXqiee8c_jrnC9a3EtYxCC6q1740gLsvCQCyozzyk1WjjpMH340_lFFwHmekJFh6bal2ZKaEN_V-0yPPPFsWiNGAsOJV1Fr3OE/s1600/6.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwv8aWIHeCbC_WILxWINhHqS71z1yRJ28tXsy9CufpY5OXqiee8c_jrnC9a3EtYxCC6q1740gLsvCQCyozzyk1WjjpMH340_lFFwHmekJFh6bal2ZKaEN_V-0yPPPFsWiNGAsOJV1Fr3OE/s400/6.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460836385821152226&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 299px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;7. Passo: Agora criamos nossa página jsp, no exemplo deixei o nome de formulario.jsp, na primeira parte da página contém o menu para escolher o idioma.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqd1vSQ-4J8ui5P-N4OC0k5bRZe1F7VnQZ7-oM0qeYQY7_-WB5p2UdDPbiK7BZxVp5fQdTSsRXL2LN1QEdaX1lMsx78rwp8MwYJF-Z-_uEdgoYzGm4cGAuzbbEur01Qf-8riwVEfmUeInz/s1600/7.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqd1vSQ-4J8ui5P-N4OC0k5bRZe1F7VnQZ7-oM0qeYQY7_-WB5p2UdDPbiK7BZxVp5fQdTSsRXL2LN1QEdaX1lMsx78rwp8MwYJF-Z-_uEdgoYzGm4cGAuzbbEur01Qf-8riwVEfmUeInz/s400/7.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460836582931561298&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 295px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;               Ainda na página formulario.jsp, iremos colocar um pequeno bloco que contém um form, conforme a imagem:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGfXj9V746sgOCoA0InMQxfTjKgmhYliJGjuaUP4TZavKAS_hCd-xGk7-_EK3u1EqDeWBT5hVjHdfNOqAhyQYhpRsk7T_TXxxKTclLyQ_0e1TYBptqqdYmyEF5uI3zyl4YECwQ1ZjCoWiw/s1600/8.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGfXj9V746sgOCoA0InMQxfTjKgmhYliJGjuaUP4TZavKAS_hCd-xGk7-_EK3u1EqDeWBT5hVjHdfNOqAhyQYhpRsk7T_TXxxKTclLyQ_0e1TYBptqqdYmyEF5uI3zyl4YECwQ1ZjCoWiw/s400/8.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460836939287586578&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 297px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;8. Passo: Veja agora como ficou o exemplo, usando o idioma Inglês:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixf_PJ7Imw2i4jebdoLabypZBJfd0jW79Q4h5vOJ457IxhBq-RxFFQVvsIWeJPFzoC8RfCkp-T0zNFqDOknozGnGCyRS6sWczdXqwdTuJQ3iP8nQBLfaXBhj8lML7n1BCYK2GzKmpGf_zg/s1600/9.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixf_PJ7Imw2i4jebdoLabypZBJfd0jW79Q4h5vOJ457IxhBq-RxFFQVvsIWeJPFzoC8RfCkp-T0zNFqDOknozGnGCyRS6sWczdXqwdTuJQ3iP8nQBLfaXBhj8lML7n1BCYK2GzKmpGf_zg/s400/9.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5458592737334334354&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 227px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;                   Idioma em português:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkhbN8P-OT1U0QAcVFc4yPDUlOfCuABFC6C4-Dla84qcaM7pFut07pOLSu1sB5H-VHtOVxLOE4AfapP3mi-549kC0dpP1v4nFy43cH4ew_HAJXrLlWSrsZiQxqAYYjRm94aWKXpALmU-H8/s1600/10.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkhbN8P-OT1U0QAcVFc4yPDUlOfCuABFC6C4-Dla84qcaM7pFut07pOLSu1sB5H-VHtOVxLOE4AfapP3mi-549kC0dpP1v4nFy43cH4ew_HAJXrLlWSrsZiQxqAYYjRm94aWKXpALmU-H8/s400/10.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5458592936616048882&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 234px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;                   Idioma em alemão:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNyyG1_28JHekg7Nef0-hesJP1LExa6aPQ795HMEDiGwet5NvcDz4G_vBH1HyOE8rAeaamc75Bpx52mCNmxdyXbtDRJemvY0176ueUtVn99wHDnbewQCXl2iXA9zVxwL3O5zeNPi5qYH9z/s1600/11.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNyyG1_28JHekg7Nef0-hesJP1LExa6aPQ795HMEDiGwet5NvcDz4G_vBH1HyOE8rAeaamc75Bpx52mCNmxdyXbtDRJemvY0176ueUtVn99wHDnbewQCXl2iXA9zVxwL3O5zeNPi5qYH9z/s400/11.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5458593169286164786&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 227px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Bom pessoal, este foi um exemplo bem simples, de como fazer a internacionalização da sua aplicação usando o produtivo Framework JSF.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Toda tradução, mostrado no exemplo, foi feita usando o Google Translate. :)&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para quem quiser baixar o exemplo, &lt;a href=&quot;http://www.4shared.com/file/pkqIxjps/internacionalizao-jsf.html&quot; target=&quot;_blank&quot;&gt;clique aqui&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Qualquer dúvida, crítica ou sugestão, fico à disposição.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt; &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/1770511487585623480/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/04/internacionalizacao-com-jsf.html#comment-form' title='5 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/1770511487585623480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/1770511487585623480'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/04/internacionalizacao-com-jsf.html' title='Internacionalização com JSF'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgitXcMbBbOAsB5O_1a5VzCEQ7hQ4g3q18yAgHvJkualPQkeWnWC_0lk-QPkd17vIp_WETyXXjCUp9_pMB4G76zXWFwnhvexc8Rl5tsdC-irIH6TKOry-6VtLm6leLuQ4ETUDR-Kqg1Doon/s72-c/1.png" height="72" width="72"/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-6664727290842907755</id><published>2010-04-02T16:15:00.000-07:00</published><updated>2010-06-13T08:06:45.166-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="JQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="JSF"/><category scheme="http://www.blogger.com/atom/ns#" term="Netbeans"/><title type='text'>Máscaras em formulários JSF, usando JQuery.</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Neste post, irei mostrar um exemplo, de como criar máscaras em formulários JSF, para isto, iremos usar a biblioteca JQuery que facilita o desenvolvimento de scripts em páginas web, além desta biblioteca, usaremos uma outra, chamada de MaskedInput.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;A biblioteca JQuery, pode ser baixada no site &lt;a href=&quot;http://jquery.com/&quot; target=&quot;_blank&quot;&gt;http://jquery.com/&lt;/a&gt; e a MaskedInput pode ser baixada no site &lt;a href=&quot;http://plugins.jquery.com/project/maskedinput&quot; target=&quot;_blank&quot;&gt;http://plugins.jquery.com/project/maskedinput&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Através da MaskedInput, conseguimos criar vários tipos de máscaras facilmente, sem a necessidade de conhecermos a fundo JavaScript.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para este exemplo, mostrarei cinco tipos de máscaras (Telefone, Cep, CPF, RG e CNPJ), usando o JSF. Estas máscaras não restringe apenas para uso no JSF, também poderá ser usado em JSP, Struts, etc...&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Ao final do post, o projeto será disponibilizado para download, para quem quiser baixar e testar.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. Passo: Crie um página de formulário em JSF, como mostrado na figura abaixo, não esquece de importar os scripts:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgK5l_VjL1YixSnzwK8qQUGuC2D_c1GriSD2cxKgR1cVANBKFtsY3OjdWFZVYGenoqXDTyQngJjz_clzF2_2Sp6oJnAfmekJPnc579w13FbW6I4maBWvXTqb76__zdXe53sHx9iaaRmZWba/s1600/1.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgK5l_VjL1YixSnzwK8qQUGuC2D_c1GriSD2cxKgR1cVANBKFtsY3OjdWFZVYGenoqXDTyQngJjz_clzF2_2Sp6oJnAfmekJPnc579w13FbW6I4maBWvXTqb76__zdXe53sHx9iaaRmZWba/s400/1.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5482273181405950674&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 306px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2. Passo: Agora, só testar, vejam como ficou o exemplo:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzAMq9xPPK00qNCE-3tHrsG47hrODDWhT9YuDX6q2Bcg4oeGuBwdL_ydSmLSlKTM6KtJe3f0w8t8Ykf-UWhpOVG5LDhak7nl10bKCNjyQ5s020Tdi8jXpBt0byr05-J1FWfxCko-rn9SCm/s1600/2.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzAMq9xPPK00qNCE-3tHrsG47hrODDWhT9YuDX6q2Bcg4oeGuBwdL_ydSmLSlKTM6KtJe3f0w8t8Ykf-UWhpOVG5LDhak7nl10bKCNjyQ5s020Tdi8jXpBt0byr05-J1FWfxCko-rn9SCm/s400/2.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460837503340870338&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 175px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Bom galera, este foi um exemplo de como usar máscaras em formulários JSF, através da biblioteca JQuery e MaskedInput.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para quem quiser baixar o projeto, &lt;a href=&quot;http://www.4shared.com/file/jHd_rTZp/JSF-Masc.html&quot; target=&quot;_blank&quot;&gt;clique aqui&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Qualquer dúvida, crítica ou sugestão, fico à disposição.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/6664727290842907755/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/04/mascaras-em-formularios-jsf-usando.html#comment-form' title='15 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/6664727290842907755'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/6664727290842907755'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/04/mascaras-em-formularios-jsf-usando.html' title='Máscaras em formulários JSF, usando JQuery.'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgK5l_VjL1YixSnzwK8qQUGuC2D_c1GriSD2cxKgR1cVANBKFtsY3OjdWFZVYGenoqXDTyQngJjz_clzF2_2Sp6oJnAfmekJPnc579w13FbW6I4maBWvXTqb76__zdXe53sHx9iaaRmZWba/s72-c/1.png" height="72" width="72"/><thr:total>15</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-6093706918086652435</id><published>2010-03-20T17:45:00.000-07:00</published><updated>2011-04-25T14:47:08.985-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="EJB"/><category scheme="http://www.blogger.com/atom/ns#" term="GlassFish"/><category scheme="http://www.blogger.com/atom/ns#" term="JSF"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="Netbeans"/><title type='text'>Login de Usuários com EJB3 e JSF (Parte 2)</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Esta é a segunda e última da parte do desenvolvimento de um Sistema de Login de Usuários, usando EJB3 para fazer a validação dos Usuários no nosso Banco de Dados, e JSF para a camada de apresentação do nosso Projeto.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Na primeira parte deixamos pronto, toda camada de EJB, agora nesta parte iremos criar o ManagedBean do Login e o Servlet Filter do Login.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Ao final do post, o projeto será disponibilizado para download, para quem quiser baixar e testar.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. Passo: Crie um ManagedBean, óbviamente dentro do projeto web, escolha o nome de LoginMB, defina um pacote com o nome managedbean, deixa seu escopo como session, feito isto, altera o código seu código, deixando igual ao da figura abaixo:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBlGz6tnqpzTHBp3Cw2Yu3RN_T-RvJ4X3k_SkXY3s9tAG5CJylQ7Nce3pOWKYuLAeqkvstyy1OBF04nM2G8LZnLl75aa1ZpBJ6ZqgUYnAV-gaFGqmHjO_I1rrt2q_UsOQdT8PuqkH-Rf_N/s1600/09.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBlGz6tnqpzTHBp3Cw2Yu3RN_T-RvJ4X3k_SkXY3s9tAG5CJylQ7Nce3pOWKYuLAeqkvstyy1OBF04nM2G8LZnLl75aa1ZpBJ6ZqgUYnAV-gaFGqmHjO_I1rrt2q_UsOQdT8PuqkH-Rf_N/s400/09.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460840368678293954&quot; style=&quot;text-align: justify; display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 339px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;No código acima, criamos dois método, um para fazer o login e o outro para fazer o logout.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2. Passo: Agora vamos criar o Servlet Filter, informe o nome de LoginFilter, defina um pacote, pode ser chamado de filter, deixa o mapeamento das URLs como *.jsf, depois de criado o Filter, altera o código do método doFilter, para o que está mostrado na figura abaixo:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjA5s61TTWNXtO9OAe6kcnNB4GVB_EpUXG12JfIS__-p2aoxhFj_0PvR8wgHAfZGib3Dx0zVBtYS1i8O0gAedVxMlGIuClDtE8ZSOKAcHxY5fOJoVKhRupjpsIpyP_reWb1gQVUQHAM2jjj/s1600/10.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjA5s61TTWNXtO9OAe6kcnNB4GVB_EpUXG12JfIS__-p2aoxhFj_0PvR8wgHAfZGib3Dx0zVBtYS1i8O0gAedVxMlGIuClDtE8ZSOKAcHxY5fOJoVKhRupjpsIpyP_reWb1gQVUQHAM2jjj/s400/10.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460840547456259794&quot; style=&quot;text-align: justify; display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 296px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;3. Passo: Deixe o arquivo faces-config.xml, como mostrado na imagem abaixo, caso não exista este arquivo, basta criá-lo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiTlk8OXBF3PpunjsvplH1WoseqgrfvxALef85O3Dn-ZbwBPsfRFkALl0V-evc944cKmOPeaz9LeEn1fyb4tmU9F_u3VQrbRnACyzRTyp5ggcAfflLdFru-RVLeKKwAkUnLjlmVgOpHrnP/s1600/11.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiTlk8OXBF3PpunjsvplH1WoseqgrfvxALef85O3Dn-ZbwBPsfRFkALl0V-evc944cKmOPeaz9LeEn1fyb4tmU9F_u3VQrbRnACyzRTyp5ggcAfflLdFru-RVLeKKwAkUnLjlmVgOpHrnP/s400/11.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460840723594077010&quot; style=&quot;text-align: justify; display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 253px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjA5s61TTWNXtO9OAe6kcnNB4GVB_EpUXG12JfIS__-p2aoxhFj_0PvR8wgHAfZGib3Dx0zVBtYS1i8O0gAedVxMlGIuClDtE8ZSOKAcHxY5fOJoVKhRupjpsIpyP_reWb1gQVUQHAM2jjj/s1600/10.png&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;4. Passo: O arquivo web.xml, deverá ficar parecido com a da figura abaixo:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXWi3gCOgQpgKELXpxwHwM6n-m4aYP5GVFSv_4kleQ97GOEzdsaR-ZJpO5knqrjmqH_eWzP8XjjOTCwmFDB2tPPg2mrm5rBt5MI3loF0HkUVikU7miBOa3h6hEAe3ts2djDD3nxh4Jf6tV/s1600/12.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXWi3gCOgQpgKELXpxwHwM6n-m4aYP5GVFSv_4kleQ97GOEzdsaR-ZJpO5knqrjmqH_eWzP8XjjOTCwmFDB2tPPg2mrm5rBt5MI3loF0HkUVikU7miBOa3h6hEAe3ts2djDD3nxh4Jf6tV/s400/12.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460840883485678546&quot; style=&quot;text-align: justify; display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 203px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;5. Passo: Agora iremos criar nossas páginas .jsp, são cinco páginas, a primeira será o index.jsp, que apenas fará o encaminhamento para página de login.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 0); -webkit-text-decorations-in-effect: none; &quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5d2aRJt9sKxoGLTkpNGVMGC1ZAQdmk-bJUkhf3Mbk3duiRANfxklkRjOMCFfSwO793JmTtt38B1eO1zfhYoDvBJveVi-N70P2gNlb7956r71GlE9D4wK6cmh4VRznOQhnpzMyxWPtgy6Z/s1600/13.png&quot; rel=&quot;lightbox&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5d2aRJt9sKxoGLTkpNGVMGC1ZAQdmk-bJUkhf3Mbk3duiRANfxklkRjOMCFfSwO793JmTtt38B1eO1zfhYoDvBJveVi-N70P2gNlb7956r71GlE9D4wK6cmh4VRznOQhnpzMyxWPtgy6Z/s400/13.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5599640648412164194&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 272px; &quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/u&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;6. Passo: Criamos agora a página para fazer o login, a página login.jsp, deverá ficar parecida com a figura abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0CJIkEMnwkxhWTkM_7pi5xyzBuWzr8rIGl4EmJVJLAyB_15EEkiQfdHS4RYsP2scx_cMNIf6Nj7_cS_WWNeeFwFCWfhJflaTn6CB8Vx79f5hM5ixZDxJgvD7SBNyXayRJ-d_XmdbLjCUr/s1600/14.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0CJIkEMnwkxhWTkM_7pi5xyzBuWzr8rIGl4EmJVJLAyB_15EEkiQfdHS4RYsP2scx_cMNIf6Nj7_cS_WWNeeFwFCWfhJflaTn6CB8Vx79f5hM5ixZDxJgvD7SBNyXayRJ-d_XmdbLjCUr/s400/14.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460841304333810834&quot; style=&quot;text-align: justify; display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 280px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0CJIkEMnwkxhWTkM_7pi5xyzBuWzr8rIGl4EmJVJLAyB_15EEkiQfdHS4RYsP2scx_cMNIf6Nj7_cS_WWNeeFwFCWfhJflaTn6CB8Vx79f5hM5ixZDxJgvD7SBNyXayRJ-d_XmdbLjCUr/s1600/14.png&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;7. Passo: Criamos agora a página home.jsp, esta página só deverá ser acessado para quem estiver logado, é uma página bem simples, conforme a figura abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvuoREuN9953ePkqvJ5tMTNfYBzWrY4VT99A0tMxgG-ssQCBQbUtEaJGbplieSA8-4d3yBmENA8z-WAVC-tr2fTLm9fuw9PhLnh29iUlywuXX9oa9Q6STlPkNa-vPpDZYVMEuuQPqayFWj/s1600/15.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvuoREuN9953ePkqvJ5tMTNfYBzWrY4VT99A0tMxgG-ssQCBQbUtEaJGbplieSA8-4d3yBmENA8z-WAVC-tr2fTLm9fuw9PhLnh29iUlywuXX9oa9Q6STlPkNa-vPpDZYVMEuuQPqayFWj/s400/15.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460841570851457762&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 271px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;8. Passo: Criamos agora a página logout.jsp, esta página se aberta quando o usuário sair do sistema, é uma página bem simples, conforme a figura abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4k56euurpz088EKLBaIqU-CI86So5giDLqP0vY4Kmj-QwjbvA3_VPv4bl-EV54V8oNzgFnsyXjYzco-cyZAirZ-wWtBn8PujVGucSYzgIGUqsWBoR0RurYNAxP8TASqjoeZel4_7xytGb/s1600/16.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4k56euurpz088EKLBaIqU-CI86So5giDLqP0vY4Kmj-QwjbvA3_VPv4bl-EV54V8oNzgFnsyXjYzco-cyZAirZ-wWtBn8PujVGucSYzgIGUqsWBoR0RurYNAxP8TASqjoeZel4_7xytGb/s400/16.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460841720983522226&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 269px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;9. Passo: Criamos agora a página falha.jsp, esta página será exibida quando um usuário inválido tentar entrar no sistema, é uma página bem simples, conforme a figura abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgygWXs5e8QZbMhMcXLQeychAD7HrJoLR78JyDZ669lND8ViKai3SgqYleieej0D1LxzQ_pkrBcqyfSg6zlXXd1v4u4DyihkPmBtWUev3j82UqL3yiiZ2JIKm55HC_oUH_Em71COGbSHRKm/s1600/17.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgygWXs5e8QZbMhMcXLQeychAD7HrJoLR78JyDZ669lND8ViKai3SgqYleieej0D1LxzQ_pkrBcqyfSg6zlXXd1v4u4DyihkPmBtWUev3j82UqL3yiiZ2JIKm55HC_oUH_Em71COGbSHRKm/s400/17.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460842087641809250&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 228px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;10. Passo: Primeiramente, iremos tentar entrar no sistema, com um usuário que não existe.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLuu1pz4Cz56wWWfbGU3rG3u-IqtPkxaVT5dsk2D3aGtfv9e1f-JpI_H_CgBO6PCNF1wjWRQSUgPTLCvlYCoI_MMDNmbyOSyI_-vnwL7ljmJ945JLuBxvRVV66YBLYz7_YwhOaxbOi2Q4M/s1600/18.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLuu1pz4Cz56wWWfbGU3rG3u-IqtPkxaVT5dsk2D3aGtfv9e1f-JpI_H_CgBO6PCNF1wjWRQSUgPTLCvlYCoI_MMDNmbyOSyI_-vnwL7ljmJ945JLuBxvRVV66YBLYz7_YwhOaxbOi2Q4M/s400/18.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460842294003639330&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 338px; height: 234px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;11. Passo: Quando não for encontrado o usuário, a página falha.jsp será exibida.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9noWj8gFMLo2kTAo5Z9ad595X-ygz-UabGz3qtfkI6qX0ViFIrHgcViwugIIGX8k_RvUu7BxU9V5jtBdp6vRUSgG8iExTaCpwXeJbT8SnjvALyOYiVueoh-kbGAE0kQbxxe8LbIVqMBkb/s1600/19.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg9noWj8gFMLo2kTAo5Z9ad595X-ygz-UabGz3qtfkI6qX0ViFIrHgcViwugIIGX8k_RvUu7BxU9V5jtBdp6vRUSgG8iExTaCpwXeJbT8SnjvALyOYiVueoh-kbGAE0kQbxxe8LbIVqMBkb/s400/19.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460842536473353554&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 325px; height: 189px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;12. Passo: Tentamos agora com um usuário que esteja cadastrado.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFzvQESfVGjed0Hc-9mfcrdwZV-aHvfatJAq24tD6XG_JVZWBX_6zZwrobgWgTEQH2tL-Tkt262H3NuZl-SxtOnj8T6K5JnQr8ZFNM32jnskaPOFMxuqgJdqxhxWlSPR6l4OuNVwWvnYIe/s1600/20.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFzvQESfVGjed0Hc-9mfcrdwZV-aHvfatJAq24tD6XG_JVZWBX_6zZwrobgWgTEQH2tL-Tkt262H3NuZl-SxtOnj8T6K5JnQr8ZFNM32jnskaPOFMxuqgJdqxhxWlSPR6l4OuNVwWvnYIe/s400/20.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460842720939540114&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 294px; height: 198px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;13. Passo: A página home será exibida, mostrando o nome do usuário que está logado.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8adeuQPGIzDvWc92pXk3b6AcH6jIHqxvB8MU38cqz6h8b9ysCZ7BP8TLFVv6MTpRudZnsKnoBqv8ilG_dCcqxJUk4PQRaW6hiyNGHTXXVUUCZYnuDgnUFMVqX7hydIKTXtkKT_jPscAo5/s1600/21.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj8adeuQPGIzDvWc92pXk3b6AcH6jIHqxvB8MU38cqz6h8b9ysCZ7BP8TLFVv6MTpRudZnsKnoBqv8ilG_dCcqxJUk4PQRaW6hiyNGHTXXVUUCZYnuDgnUFMVqX7hydIKTXtkKT_jPscAo5/s400/21.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460842861504477650&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 294px; height: 179px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;14. Passo: Quando o usuário, sair do sistema, a página logout será exibida.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhC2EyguvoC8vy_N4N3JNpy7zCtJql7zr2HcNYFzt-YIS3rwPlaotrhmKMsjhw06BoqLA3vB0flhmdVa7vEx5QRkPqI8gWRUzZtqinBSXhFfPye_asq0_ZzMdYyUn1KqCavHjMGbjntd8gr/s1600-h/22.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 0); -webkit-text-decorations-in-effect: none; &quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgub2HOwyLsw6Tb8xf_zj8oAz8dQ_aAsR21WMad_-lud_fVfzqBURiZ7u3prxlIt-stPOJ3WNyDzRtbOmMVbzOAHgasRkSQzyW9olN0IDsOhfr1jTRJeDcgmO_KUAE8i9ti7FXJWKEljCWW/s1600/22.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgub2HOwyLsw6Tb8xf_zj8oAz8dQ_aAsR21WMad_-lud_fVfzqBURiZ7u3prxlIt-stPOJ3WNyDzRtbOmMVbzOAHgasRkSQzyW9olN0IDsOhfr1jTRJeDcgmO_KUAE8i9ti7FXJWKEljCWW/s400/22.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460842986886650994&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 340px; height: 210px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Terminamos, o nosso projeto de Login, usando EJB3, Servlet Filter e JSF.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para quem quiser baixar o projeto, &lt;a href=&quot;http://www.4shared.com/file/245693931/b666df93/Login.html&quot; target=&quot;_blank&quot;&gt;clique aqui&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Qualquer dúvida, crítica ou sugestão, fico a disposição.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/6093706918086652435/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/03/login-de-usuarios-com-ejb3-e-jsf-parte.html#comment-form' title='4 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/6093706918086652435'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/6093706918086652435'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/03/login-de-usuarios-com-ejb3-e-jsf-parte.html' title='Login de Usuários com EJB3 e JSF (Parte 2)'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBlGz6tnqpzTHBp3Cw2Yu3RN_T-RvJ4X3k_SkXY3s9tAG5CJylQ7Nce3pOWKYuLAeqkvstyy1OBF04nM2G8LZnLl75aa1ZpBJ6ZqgUYnAV-gaFGqmHjO_I1rrt2q_UsOQdT8PuqkH-Rf_N/s72-c/09.png" height="72" width="72"/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-1117906280735256838</id><published>2010-03-20T11:54:00.000-07:00</published><updated>2011-04-25T14:35:33.774-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="EJB"/><category scheme="http://www.blogger.com/atom/ns#" term="GlassFish"/><category scheme="http://www.blogger.com/atom/ns#" term="JSF"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="Netbeans"/><title type='text'>Login de Usuários com EJB3 e JSF (Parte I)</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Neste post irei mostrar um exemplo simples de como fazer autentificação de usuários, usando EJB3, para a regra de negócio, e o Framework JSF para a camada de apresentação, poderia ser um Servlet ou JSP para view. A aplicação foi desenvolvida no Netbeans 6.8, servidor GlassFish v3 e o Banco de Dados MySQL.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Por estarmos usando o JSF, poderiamos fazer o controle de autentificação usando um próprio recurso do JSF chamado de PhaseListener, que fica de uma forma mais integrado. Porém neste exemplo, será feito utilizando o bom e velho Filter.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Este post será dividido em duas partes, sendo que a primeira, iremos criar o BD e a tabela Usuario, também será criado o projeto no Netbeans, deixando toda a camada de EJB pronta. Para a segunda parte, será criado o Servlet Filtro e a camada do JSF.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Ao final do post, o projeto será disponibilizado para download, para quem quiser baixar e testar.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. Passo: A primeira coisa que devemos fazer é criar um Banco de Dados no Mysql, para isto basta usar seu programa de Gerenciamento de Banco de Dados e digitar o seguinte comando:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;CREATE DATABASE JAVA;&lt;/div&gt;&lt;/code&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para criar a tabela de Usuário, use o seguinte comando:&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size:small;&quot;&gt;&lt;code&gt;CREATE TABLE USUARIO (&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family:monospace;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size:small;&quot;&gt;&lt;code&gt;nome VARCHAR(20) PRIMARY KEY,&lt;br /&gt;senha VARCHAR(20)&lt;br /&gt;);&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Criado nosso BD e a Tabela, já deixaremos um Usuário cadastro, para mais tarde podermos testar, simplesmente, digite o código abaixo:&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;INSERT INTO USUARIO values (&#39;jabes&#39;, &#39;jabes&#39;);&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2.Passo: Iremos criar um projeto JEE no Netbeans, para isto escolha Enterprise Application, o nome do projeto será Login, escolha o servidor GlassFish, criando um módulo EJB e um WAR.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;A estrutura do projeto ficará parecida com a imagem abaixo:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color:#0000EE;&quot;&gt;&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 0); -webkit-text-decorations-in-effect: none; &quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjK7t6YidpM_Ex_k6xWt71LQq4gkfeyxg1D4Q1lTsaENJsdHSHbl3OjluDZ2nJpOwJ8CfAk7T3DyAMIwQZa_Lv1F0FECIzmcXpKWT_bnMeri2hOjWCpLKCjjl6wtgeeAddGEzxkPa4uhdlW/s1600/01.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjK7t6YidpM_Ex_k6xWt71LQq4gkfeyxg1D4Q1lTsaENJsdHSHbl3OjluDZ2nJpOwJ8CfAk7T3DyAMIwQZa_Lv1F0FECIzmcXpKWT_bnMeri2hOjWCpLKCjjl6wtgeeAddGEzxkPa4uhdlW/s400/01.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460837972737044098&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 385px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color:#0000EE;&quot;&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;3. Passo: Agora vamos criar a Entidade (Classe) Usuário, que será nosso modelo, para não digitarmos a Classe na unha, iremos importar a mesma do Banco. Clique com o botão direito do mouse sobre o módulo EJB, e escolha Entity Classes from DataBase, conforme a figura abaixo:&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color:#0000EE;&quot;&gt;&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color:#000000;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-text-decorations-in-effect: none; &quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0TNd2D5dXJ1K6d4F_X_-HUZ1Qunll7HRt1e8fhNgR_z_WMmx0G7qUzcYgvkIO6uPSoWVvnpcznARKtU2LZLjXfRfTbvx-n_eP3d3fkbJhr7R6GpLNhBY9Gm7gloXuhaZ6_iJDDuTtzbGz/s1600/02.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0TNd2D5dXJ1K6d4F_X_-HUZ1Qunll7HRt1e8fhNgR_z_WMmx0G7qUzcYgvkIO6uPSoWVvnpcznARKtU2LZLjXfRfTbvx-n_eP3d3fkbJhr7R6GpLNhBY9Gm7gloXuhaZ6_iJDDuTtzbGz/s400/02.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460838186150110098&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 336px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color:#0000EE;&quot;&gt;&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color:#000000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;4. Passo: Escolha um Data Source que use  o MySQL e o nosso Banco de Dados que foi criado, caso não exista um, basta criar um novo DS, depois de escolhido o DS, adicionar a tabela Usuario, clique em Next, conforme mostra a imagem abaixo:&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUJzYI580jx05tYO_i1O4iiT6rilDPIDgR_DxCMxW_SDSA4tdp2aMGezZNLo-3YxcIUZ_3W3RnSfFodU4XbVspcgExrAHJqtqMGKbWqu2ewgSDkPhl00GzHblZpGv5fajEl3Q7eTExgerJ/s1600/03.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUJzYI580jx05tYO_i1O4iiT6rilDPIDgR_DxCMxW_SDSA4tdp2aMGezZNLo-3YxcIUZ_3W3RnSfFodU4XbVspcgExrAHJqtqMGKbWqu2ewgSDkPhl00GzHblZpGv5fajEl3Q7eTExgerJ/s400/03.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460838574940401506&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 274px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;5. Passo: Informe o nome do pacote, no exemplo deixei como loginservice, depois clique em Next.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghimjUlWIyOFCE_QtReEDkONUkl84R_44hb-OS5HWSmV3iFLitiY5wR038eN6b1hDOQE6kttuYMKeJXUHaMcFd_qohNap9u8pLPL2OuaVAYJdIcJfa4C28NXsSra7ClqEaHM36iqNH07jk/s1600/04.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghimjUlWIyOFCE_QtReEDkONUkl84R_44hb-OS5HWSmV3iFLitiY5wR038eN6b1hDOQE6kttuYMKeJXUHaMcFd_qohNap9u8pLPL2OuaVAYJdIcJfa4C28NXsSra7ClqEaHM36iqNH07jk/s400/04.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460838828227235458&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 267px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;6. Passo: Na configuração do mapeamento da Entidade, configurar de acordo com a figura abaixo, depois, clique em Finish:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgd0doLkvMlljwPTlNmPvN4RKiGvXa9AV_MoeWxiHhd12pzDoYCKDUqbKrYmJ8taY0kvqNCC4k44dhRmuS6e0vWo1Mcz7gJGNqiv-wMNwoXadtEQD_LmvIlnWHY6XULsm0r0nVjL09xxYSw/s1600/05.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgd0doLkvMlljwPTlNmPvN4RKiGvXa9AV_MoeWxiHhd12pzDoYCKDUqbKrYmJ8taY0kvqNCC4k44dhRmuS6e0vWo1Mcz7gJGNqiv-wMNwoXadtEQD_LmvIlnWHY6XULsm0r0nVjL09xxYSw/s400/05.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460838981778128578&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 264px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;7. Passo: Será criado a Classe Usuario, com todas Annotations, conforme a imagem abaixo:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiafl97HOvXiZ009wl4lYQsel4Sw0l_WGOy8HFZLKu5pyZPZ8hLLzWG4jsCT5XktuLxOqRDbhvnj4y6SdiKZ3n_SChkfRvX8pJNAgzJGcQu7stLniVw2PwhJV8pJ2OSPLOJ_dzU5LLlGyfu/s1600/06.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiafl97HOvXiZ009wl4lYQsel4Sw0l_WGOy8HFZLKu5pyZPZ8hLLzWG4jsCT5XktuLxOqRDbhvnj4y6SdiKZ3n_SChkfRvX8pJNAgzJGcQu7stLniVw2PwhJV8pJ2OSPLOJ_dzU5LLlGyfu/s400/06.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460839172268656930&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 276px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;8. Passo: Agora iremos criar um Session Bean, do tipo Stateless, com o nome de LoginService, implementando uma Interface Local, ambos, no pacote loginservice, crie um método chamado verificarUsuario que retorna um boolean e que tem como parâmetro um Objeto do tipo Usuario na Interface LoginServiceLocal, na Classe LoginService, altera seu código, deixando-o, igual ao da figura abaixo:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihHcNHgjWb5wE2FLjnUcLI1VtyJ0N-7taXdZrTW0YD9IooVAiQ7Zbh2scDUCVICqul36tvtOEiLTqVDNC_MrENG7Xk_0pB0XHiC-6HwjhYKxwPzEg7Riq96P9DMDX0pwiml0v4GEh6bCBI/s1600/07.png&quot; rel=&quot;lightbox&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihHcNHgjWb5wE2FLjnUcLI1VtyJ0N-7taXdZrTW0YD9IooVAiQ7Zbh2scDUCVICqul36tvtOEiLTqVDNC_MrENG7Xk_0pB0XHiC-6HwjhYKxwPzEg7Riq96P9DMDX0pwiml0v4GEh6bCBI/s400/07.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5599637526235605938&quot; style=&quot;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 341px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Aqui, terminamos nossa primeira parte da Aplicação, deixando a camada de EJB pronta, e na próxima e última parte, iremos terminar, com a criação do Servlet Filter e do ManagedBean.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/1117906280735256838/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/03/login-de-usuarios-com-ejb3-e-jsf-parte_20.html#comment-form' title='9 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/1117906280735256838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/1117906280735256838'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/03/login-de-usuarios-com-ejb3-e-jsf-parte_20.html' title='Login de Usuários com EJB3 e JSF (Parte I)'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjK7t6YidpM_Ex_k6xWt71LQq4gkfeyxg1D4Q1lTsaENJsdHSHbl3OjluDZ2nJpOwJ8CfAk7T3DyAMIwQZa_Lv1F0FECIzmcXpKWT_bnMeri2hOjWCpLKCjjl6wtgeeAddGEzxkPa4uhdlW/s72-c/01.png" height="72" width="72"/><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-8022643332020976438</id><published>2010-03-07T16:46:00.000-08:00</published><updated>2010-07-15T18:34:15.645-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="EJB"/><category scheme="http://www.blogger.com/atom/ns#" term="GlassFish"/><category scheme="http://www.blogger.com/atom/ns#" term="JSP e Servlet"/><category scheme="http://www.blogger.com/atom/ns#" term="Netbeans"/><title type='text'>Exemplo de EJB, criando um Session Bean Stateless no Netbeans 6.8 e Glassfish V3.</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Neste post, iremos criar uma simples aplicação EJB3, para quem não sabe, EJB3 é uma plataforma para a construção de aplicações corporativas portável, que permite o desenvolvimento de componentes reutilizáveis, há 3 tipos de componentes EJB, (Session Beans que pode ser Stateless ou Statefull, Message Driven e Entidades) para este exemplo iremos fazer um exemplo de Bean de Sessão sem estado,.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Session Bean Stateless pode ser usado para implementar a lógica corporativa em uma aplicação, ele pode ser acessado por milhares de clientes, pois não armazenam estado.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para este exemplo, iremos usar a IDE Netbeans 6.8 e o Servidor Glassfish.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; color: rgb(51, 51, 51); line-height: 20px; font-family:Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Ao final do post, o projeto será disponibilizado para download, para quem quiser baixar e testar.&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. Passo: Começaremos com a construção do projeto.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2fW1pV4oX4O9M86H3Ps9gGHj3Y3XV2tYyD0QavJrMDTRxDcOv8bjHL_f63S9qjX4ZbcW3PzGQi4go9VEdS4X3TTSp-J09IV1gGV4JbIbFRnQPCwaTLA0Oz2uQPl7Trm_nSXK1T0Tnkovz/s1600/1.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2fW1pV4oX4O9M86H3Ps9gGHj3Y3XV2tYyD0QavJrMDTRxDcOv8bjHL_f63S9qjX4ZbcW3PzGQi4go9VEdS4X3TTSp-J09IV1gGV4JbIbFRnQPCwaTLA0Oz2uQPl7Trm_nSXK1T0Tnkovz/s400/1.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463486532298425922&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 301px; height: 332px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2. Passo: Escolha o tipo do projeto, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0bcJFW5pWhLlbDUe0NtJdL7V73iUL7ie6Vu3VV15YYQj4RdLs3-KJpaKg1h-xlgba0uhrZKQiAyDIgQhZM4fgoWMAcMkYt2usMituIjI0dAyp5QluQYOikGYGKK9FQbZBwNHealZS86tb/s1600/2.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0bcJFW5pWhLlbDUe0NtJdL7V73iUL7ie6Vu3VV15YYQj4RdLs3-KJpaKg1h-xlgba0uhrZKQiAyDIgQhZM4fgoWMAcMkYt2usMituIjI0dAyp5QluQYOikGYGKK9FQbZBwNHealZS86tb/s400/2.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463486845208618834&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 251px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;3. Passo: Informe o nome do projeto e onde o mesmo será salvo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAgcorToZseLmeomxUsoLaI19SYY8ojV6uWKTgfsY0K73RwBQGES-HLV9qdfUtzv8PsF6HFK_OIQgMYicO9NASzQOKqjuD9yD13O7IXUIIvwC2YezZZJH4al-SEPccB-tdsIv6T9R_ml7q/s1600/3.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgAgcorToZseLmeomxUsoLaI19SYY8ojV6uWKTgfsY0K73RwBQGES-HLV9qdfUtzv8PsF6HFK_OIQgMYicO9NASzQOKqjuD9yD13O7IXUIIvwC2YezZZJH4al-SEPccB-tdsIv6T9R_ml7q/s400/3.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463487022827968050&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 252px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;4. Passo: Na tela seguinte, escolha o servidor &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space:pre&quot;&gt; &lt;/span&gt;Glassfish v3, conforme a imagem abaixo, por fim, clique em Finalizar.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgs6-KylUAC4CQ-XMYiWVT8rRoPofjt1q1gkGQNRENrHOOYvzzAa4c4-McXq5wLYjfTnoMhw3Tzr7N9betpewvadvzAB5UiWH-76BZ5M3fJPN39P6_WtjKsjElcnNGlGFpSdTMWPBhAm3n4/s1600/4.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgs6-KylUAC4CQ-XMYiWVT8rRoPofjt1q1gkGQNRENrHOOYvzzAa4c4-McXq5wLYjfTnoMhw3Tzr7N9betpewvadvzAB5UiWH-76BZ5M3fJPN39P6_WtjKsjElcnNGlGFpSdTMWPBhAm3n4/s400/4.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463487176247454642&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 264px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;5. Passo: Clique com o botão direito do mouse, sobre o módulo EJB -&gt; Novo -&gt; Bean Sessão, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZNvPt93ddrcL2odfLGPmXtEKM2LQyUWGHpv14Wm6gb2KN0OHjMwgDLU2zPkYy2zf0he4tPrj1AzBcMgIJ0IPaWY6Ewcr4Vii4gSghNtbKuUTdmmYDVU2svw6VENp5h39bU50Huq9Ay0J7/s1600/5.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZNvPt93ddrcL2odfLGPmXtEKM2LQyUWGHpv14Wm6gb2KN0OHjMwgDLU2zPkYy2zf0he4tPrj1AzBcMgIJ0IPaWY6Ewcr4Vii4gSghNtbKuUTdmmYDVU2svw6VENp5h39bU50Huq9Ay0J7/s400/5.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463487335334175442&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 355px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;6. Passo: Na tela seguinte, informe o nome do EJB, seu pacote, o tipo de sessão e escolha a Interface Local, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_2Zpt_2tr-PbWG9GEdSr45bOk8LpQrqxc8YlbmZV_eYNKfuvibeVQSC-aKk9fBvij8Fa4aj38jz1koIQRwMdBQWnHk6bTao8UJtc3Q5TsEhKszFaqEFl6TGdLC44aR-of8iKOn7BWKPKr/s1600/6.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_2Zpt_2tr-PbWG9GEdSr45bOk8LpQrqxc8YlbmZV_eYNKfuvibeVQSC-aKk9fBvij8Fa4aj38jz1koIQRwMdBQWnHk6bTao8UJtc3Q5TsEhKszFaqEFl6TGdLC44aR-of8iKOn7BWKPKr/s400/6.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463487501611995730&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 277px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;7. Passo: Com a Classe CalcularIPI aberta, clique com o botão direito do mouse -&gt; Insere código, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSTPKCM4vsFHkN6nWPR6QrORZdLXX58ldaCixaNo1HjGwm0902IxapUg8_IdyduOwUEpBr8kIwSxkMn2TALq4-Y9xDLHrcvnFSfQqPG9ZLG1aeHaDGSRTbW5i8NqvDXrwFqEGErQGMwLj5/s1600/7.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSTPKCM4vsFHkN6nWPR6QrORZdLXX58ldaCixaNo1HjGwm0902IxapUg8_IdyduOwUEpBr8kIwSxkMn2TALq4-Y9xDLHrcvnFSfQqPG9ZLG1aeHaDGSRTbW5i8NqvDXrwFqEGErQGMwLj5/s400/7.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463487647008264162&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 367px; height: 385px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;8. Passo: Agora escolha -&gt; Adicionar método de negócio, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6a21T18qHYaCwFw6RMReJnYZXG1K_OhzSJg8Wa9nfHlAVu0OLuN19qD7hpNvU3qSud-Q9r0sfEoYuGGH3GPB0gcJdqk9oPDnMT2uC-gBZGzRbPi7h3ta6x-8-r_iBnsKB7nm9Pv8FR7dJ/s1600/8.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6a21T18qHYaCwFw6RMReJnYZXG1K_OhzSJg8Wa9nfHlAVu0OLuN19qD7hpNvU3qSud-Q9r0sfEoYuGGH3GPB0gcJdqk9oPDnMT2uC-gBZGzRbPi7h3ta6x-8-r_iBnsKB7nm9Pv8FR7dJ/s400/8.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463487775417502130&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 396px; height: 331px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;9. Passo: Agora, informe o nome do método, o tipo de retorno e os parâmetros, conforme a imagem abaixo, por fim, clique em OK.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEyrlFdaajyeB6HNAdZJbEKtOwzKgJWyo68aj_SzvZz3dAuBwfCX6icwpZXPOAHh7zxYlQsr2oYWXergPVTN9yMHtGpt6PjkNC-jbTUJL-Ozf1RGxBPfeu39wfnedbWfyWN1yOfxaIbX3-/s1600/9.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEyrlFdaajyeB6HNAdZJbEKtOwzKgJWyo68aj_SzvZz3dAuBwfCX6icwpZXPOAHh7zxYlQsr2oYWXergPVTN9yMHtGpt6PjkNC-jbTUJL-Ozf1RGxBPfeu39wfnedbWfyWN1yOfxaIbX3-/s400/9.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463487944400873570&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 324px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;10. Passo: Foi criado uma Interface Local.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTyK1SJEQ0s7SQdxthIFzC4Oks8pVCbvQdDFm04_oyE0Ws1hU1-XyBfboIUoDeKOkhnV6-xH3Gz0Rw3vrC9IxmnEJ167qmZ-NC1dcIkrk75DPCRFraDylpVulxVyRIEIgeFSrmdNXM8WT9/s1600/10.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTyK1SJEQ0s7SQdxthIFzC4Oks8pVCbvQdDFm04_oyE0Ws1hU1-XyBfboIUoDeKOkhnV6-xH3Gz0Rw3vrC9IxmnEJ167qmZ-NC1dcIkrk75DPCRFraDylpVulxVyRIEIgeFSrmdNXM8WT9/s400/10.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463488086932670082&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 368px; height: 275px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;11. Passo: Altera o conteúdo da Classe CalcularIPI, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDjef-CwqbafHBKkaxX4htMqGLAgR5Fw_hkoPlWi0oQ6DPOEzRLORKjLfKy2gQ_N_Q457PC8f8YKQSJHbgJXy2W3WfcMB7WGjDFFIzQPOC1mPlE5-aFFp3Hzk5dEZ9MoR5YVfy2DOUYww9/s1600/11.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDjef-CwqbafHBKkaxX4htMqGLAgR5Fw_hkoPlWi0oQ6DPOEzRLORKjLfKy2gQ_N_Q457PC8f8YKQSJHbgJXy2W3WfcMB7WGjDFFIzQPOC1mPlE5-aFFp3Hzk5dEZ9MoR5YVfy2DOUYww9/s400/11.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463488279167032098&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 279px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;12. Passo: Para testamos nosso Session Bean, iremos criar um Servlet, para isto, clique com o botão direito no módulo web, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEideio6vtmUJDOnZ41BDJizNfHTtemxKes6dGQpnRK6xYtNEpm6ukE0xoUOtt_fvEBcGfHGFxaVmwD4VHecqGIFk61pfVFoXQQ5DzuPa9QQT_pwi-fKIjl97cBmwA-yAhf0eRgRplj_aMsj/s1600/12.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEideio6vtmUJDOnZ41BDJizNfHTtemxKes6dGQpnRK6xYtNEpm6ukE0xoUOtt_fvEBcGfHGFxaVmwD4VHecqGIFk61pfVFoXQQ5DzuPa9QQT_pwi-fKIjl97cBmwA-yAhf0eRgRplj_aMsj/s400/12.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463488447950030690&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 359px; height: 361px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;13. Passo: Na tela seguinte, informe o nome e o pacote do Servlet e depois clique em Finalizar, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL7FqBx2XUZbf_0VI511YTBS3wXNQ7D7iRAzU2e7SwB8_eo-PssXnE5YmEIZgbBpxUSLaaQ5-neGsMofZyMIqa9pCyYWe70mRCLuzq_NWeNZFMXGQWyKJ8D2mCUs2zF4qzfp5wYQ21mz2a/s1600/14.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL7FqBx2XUZbf_0VI511YTBS3wXNQ7D7iRAzU2e7SwB8_eo-PssXnE5YmEIZgbBpxUSLaaQ5-neGsMofZyMIqa9pCyYWe70mRCLuzq_NWeNZFMXGQWyKJ8D2mCUs2zF4qzfp5wYQ21mz2a/s400/14.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463488602258371042&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 361px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;14. Passo: Com o Servlet aberto, clique com o botão direito do mouse sobre o código, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigBh3gtzrPWnJsHOmFQ2lShj9rOFFlYg9G8dHqr7y7Cc8xZ33k3fHTemEVjgQqKnH5x-spENrul16Vdmh2xfhyTXsSWVHncyTbGRdjc8luLUf3XKCd10p9Nd64qDolaFMiyyYZT7pzsAmX/s1600/14.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigBh3gtzrPWnJsHOmFQ2lShj9rOFFlYg9G8dHqr7y7Cc8xZ33k3fHTemEVjgQqKnH5x-spENrul16Vdmh2xfhyTXsSWVHncyTbGRdjc8luLUf3XKCd10p9Nd64qDolaFMiyyYZT7pzsAmX/s400/14.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463488752200150114&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 361px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;15. Passo: Escolha -&gt; Chamar Enterprise Bean, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEaUF2g6oqhMaHtBmDbY-hs_VxZpA8IYARpz9TzGgvhtht9Wf8afHMIge_neFGaddZO3gerWW7Q3dEhNU4yAY6CElEaLBaQxYvNmZda0mWa7rR1_71dyr0J8ABZpKQbU62YolzsibfvvDy/s1600/15.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEaUF2g6oqhMaHtBmDbY-hs_VxZpA8IYARpz9TzGgvhtht9Wf8afHMIge_neFGaddZO3gerWW7Q3dEhNU4yAY6CElEaLBaQxYvNmZda0mWa7rR1_71dyr0J8ABZpKQbU62YolzsibfvvDy/s400/15.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463488901166379858&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 316px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;16. Passo: Escolha o EJB CalcularIPI, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtaERS_isiLOALQ5LGVdwQ5D0gMsZ8-6843P2yNPBOiyuqrO3pUDo3zVEhFeRhQyw5g6sQrege4lg0AJpl8tn-7B9HwnxG_-T-7B6ZMjs59K3YhSLGLgNF85pLxUL-pyEGcocYSII4zKit/s1600/16.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjtaERS_isiLOALQ5LGVdwQ5D0gMsZ8-6843P2yNPBOiyuqrO3pUDo3zVEhFeRhQyw5g6sQrege4lg0AJpl8tn-7B9HwnxG_-T-7B6ZMjs59K3YhSLGLgNF85pLxUL-pyEGcocYSII4zKit/s400/16.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463489025214906418&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 356px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;17. Passo: Com o Servlet aberto, altera o código, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVOandXe26tAClnZ0jdIGQxiVDGVJ0PBaChyeF7uxQCTmE3t8e0-k5Pr6QATHiZMPWhorivKwfrZhRVHubW8U8qZc3sdG7PyiwMtmwXaIkwlGv1A6H1PEqlMZAafnYVLS4VmGUQxTCTzeT/s1600/17.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVOandXe26tAClnZ0jdIGQxiVDGVJ0PBaChyeF7uxQCTmE3t8e0-k5Pr6QATHiZMPWhorivKwfrZhRVHubW8U8qZc3sdG7PyiwMtmwXaIkwlGv1A6H1PEqlMZAafnYVLS4VmGUQxTCTzeT/s400/17.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463489148164167026&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 308px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;18. Passo: Clique com o botão direito sobre o módulo EJB -&gt; Implantar.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;http://4.bp.blogspot.com/_4xf3yGFr_xk/S9I2jwKEZoI/AAAAAAAAAjo/uHgJY6AlZeE/s1600/18.png&quot;&gt;&lt;img src=&quot;http://4.bp.blogspot.com/_4xf3yGFr_xk/S9I2jwKEZoI/AAAAAAAAAjo/uHgJY6AlZeE/s400/18.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463489285804287618&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 336px; height: 380px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;19. Passo: Clique com o botão direito sobre o módulo Web -&gt; Implantar.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwnvhOfHdpbRT1xiH04v_hDYFROUr3s9o-IvtNYX3Yk5vgDrW838PYHqyAalxmsRURxJ_eIbVtEgslHzDC6WKbFLOueS7AlX1op-p29MhagdaDyVL_2ENSwurYVbwTWolYo-EPam7i-owl/s1600/19.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwnvhOfHdpbRT1xiH04v_hDYFROUr3s9o-IvtNYX3Yk5vgDrW838PYHqyAalxmsRURxJ_eIbVtEgslHzDC6WKbFLOueS7AlX1op-p29MhagdaDyVL_2ENSwurYVbwTWolYo-EPam7i-owl/s400/19.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463489427457157106&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 251px; height: 295px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;20. Passo: Clique com o botão direito sobre o módulo Web -&gt; Executar.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFVQdpPkDac3D5odiObCUSQzbHv2DFmiRoVUl30SS3mlP28eGnNd2_5C-jiUSr6DpP08IfSoBeQgvou1k2qlwQZIzdr6KEeDcVYZyZjMu_Rrt_GSoPlXcJjcAOKY62aq40q2bJ7QRBSElI/s1600/20.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFVQdpPkDac3D5odiObCUSQzbHv2DFmiRoVUl30SS3mlP28eGnNd2_5C-jiUSr6DpP08IfSoBeQgvou1k2qlwQZIzdr6KEeDcVYZyZjMu_Rrt_GSoPlXcJjcAOKY62aq40q2bJ7QRBSElI/s400/20.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463489564961455634&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 268px; height: 296px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;21. Passo: Agora para testar o exemplo, informe o nome do Servlet, na barra de endereço de seu navegador, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtAQQUEQc_LI8gI4CJdzQutQJVBwLB1dVn9jBQsGs1IADxcOZBuVKxIQKM6LtjbX1EwW7HRcwn0n3U-AMQONTMamfH8992YCawfO0bPYaqDg5YV76kO0UFLEmez_1XrUb5EYgftkszAeXl/s1600/21.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhtAQQUEQc_LI8gI4CJdzQutQJVBwLB1dVn9jBQsGs1IADxcOZBuVKxIQKM6LtjbX1EwW7HRcwn0n3U-AMQONTMamfH8992YCawfO0bPYaqDg5YV76kO0UFLEmez_1XrUb5EYgftkszAeXl/s400/21.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5463489699270700866&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 218px; &quot; /&gt;&lt;/a&gt;Terminamos, o nosso exemplo de Bean de Sessão sem estado, que foi um criado um simples método, que calcula o valor do produto + o valor do IPI, retornando o valor total do produto.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para quem quiser baixar o projeto, &lt;a href=&quot;http://www.4shared.com/file/236480538/9f90aa82/ExemploSessionBeanStateless.html&quot; target=&quot;_blank&quot;&gt;clique aqui&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Qualquer dúvida, crítica ou sugestão, fico a disposição.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/8022643332020976438/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/03/exemplo-de-ejb-criando-um-session-bean.html#comment-form' title='3 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/8022643332020976438'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/8022643332020976438'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/03/exemplo-de-ejb-criando-um-session-bean.html' title='Exemplo de EJB, criando um Session Bean Stateless no Netbeans 6.8 e Glassfish V3.'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2fW1pV4oX4O9M86H3Ps9gGHj3Y3XV2tYyD0QavJrMDTRxDcOv8bjHL_f63S9qjX4ZbcW3PzGQi4go9VEdS4X3TTSp-J09IV1gGV4JbIbFRnQPCwaTLA0Oz2uQPl7Trm_nSXK1T0Tnkovz/s72-c/1.png" height="72" width="72"/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-8730411375758771153</id><published>2010-03-07T08:57:00.000-08:00</published><updated>2011-04-25T14:50:49.178-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="Hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="JSF"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="TomCat"/><title type='text'>CRUD com JSF e Hibernate usando Eclipse, TomCat e MySQL (Parte 3)</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Chegamos na última parte numa série de três partes, que envolveu o desenvolvimento de um CRUD de Usuário. Nas partes anteriores, configuramos o TomCat no Eclipse, criamos o projeto do tipo web, e desenvolvemos e testamos nossa camada de persistência.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Por fim, iremos criar a camada de apresentação, que será desenvolvida pelo Framework JSF.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 20px; font-family: Arial, Helvetica, sans-serif; &quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: medium; &quot; &gt;Ao final do post, o projeto será disponibilizado para download, para quem quiser baixar e testar.&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. Passo: Abre o arquivo faces-config.xml, e selecione a aba ManagedBean -&amp;gt; session -&amp;gt; add.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTz8HOfygVN9RTPkJ2Gry_HsCdSnA_JUC4boxR9Yoy1Ze7GeXffNS7YO0fUeKhyphenhyphen_USV3tFNZaFoFDWzCLw-hJ6W637oEZR49balwleLCd9nP1CBmsWJQOP3C8NGT4-0dZjmGhW5gLtsSQB/s1600/39.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTz8HOfygVN9RTPkJ2Gry_HsCdSnA_JUC4boxR9Yoy1Ze7GeXffNS7YO0fUeKhyphenhyphen_USV3tFNZaFoFDWzCLw-hJ6W637oEZR49balwleLCd9nP1CBmsWJQOP3C8NGT4-0dZjmGhW5gLtsSQB/s400/39.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460830512091997522&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 276px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2. Passo: Na tela seguinte, deixar, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy7tEQoQ67jlu6PfUfLxxvcS5YghTg13K9gRwTeZ9xQ2LufaeFqJL4y2J5qQ7QJOV-YYWAaL7lW9fDLfs7DIqvPJ4qCcUQPsMSkxZVZH5crchIMwqMJ-3ebAveRy_7KLyfPeOoiELF-62T/s1600/40.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy7tEQoQ67jlu6PfUfLxxvcS5YghTg13K9gRwTeZ9xQ2LufaeFqJL4y2J5qQ7QJOV-YYWAaL7lW9fDLfs7DIqvPJ4qCcUQPsMSkxZVZH5crchIMwqMJ-3ebAveRy_7KLyfPeOoiELF-62T/s400/40.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460830711851755250&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 370px; height: 387px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;3. Passo: Na próxima tela, informar o nome do ManagedBean e do Pacote, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEmSp6_xQINmCmfRUrdR3ZU_w3GoRQsDFsFvaM4QohnmDXchp8ZUm6so6wr9OGLe_PcVtPLOlTrlL3nMM83m2osb32IMz9Abo0XCWRgYfRgOJfZYn_FOlJukFT2WApV7e3TFFhDAJZENeX/s1600/41.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEmSp6_xQINmCmfRUrdR3ZU_w3GoRQsDFsFvaM4QohnmDXchp8ZUm6so6wr9OGLe_PcVtPLOlTrlL3nMM83m2osb32IMz9Abo0XCWRgYfRgOJfZYn_FOlJukFT2WApV7e3TFFhDAJZENeX/s400/41.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460830958978471906&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 373px; height: 389px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;4. Passo: Na tela seguinte, informe o nome e o escopo do ManagedBean, conforme a imagem abaixo, e depois clica em finish.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic-kdF3Ixym7H711kikAUcrzMSdAzQE9H6htPgMtERQpNdpcazurq_HaQHxWwFliGSG42rjopcS5BtoU3P2L8jwC4IOB0Q2tTy0MoS3wnng5KJWEdNnXKiOPwnsz74YIP5wDc3YbcZBmBA/s1600-h/42.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 0); -webkit-text-decorations-in-effect: none; &quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji05zrJ7NiFrF2XxpOHWRWp0FP0KgXSz_TKJJqLLEUfDf2sBgGxjglGD8irq7wYzCLXkcB9SFnE0prqj69904PJo5i0ZtVNzzc-lnUUd2goYDF4poTBhZNh-QKGIqkDXFYL6atJScMrJ58/s1600/42.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEji05zrJ7NiFrF2XxpOHWRWp0FP0KgXSz_TKJJqLLEUfDf2sBgGxjglGD8irq7wYzCLXkcB9SFnE0prqj69904PJo5i0ZtVNzzc-lnUUd2goYDF4poTBhZNh-QKGIqkDXFYL6atJScMrJ58/s400/42.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460831181819669618&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 376px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic-kdF3Ixym7H711kikAUcrzMSdAzQE9H6htPgMtERQpNdpcazurq_HaQHxWwFliGSG42rjopcS5BtoU3P2L8jwC4IOB0Q2tTy0MoS3wnng5KJWEdNnXKiOPwnsz74YIP5wDc3YbcZBmBA/s1600-h/42.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;5. Passo: O arquivo faces-config.xml, deverá estar, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaOH80WefT8b2ACG-dHA-juYNfkPXHnnBdi-kF-475VzPRsgvdzQ7wxf4ykyRfPuyCDTwvW_VH9l3VReCHAS7MCPnmLLXstYerho61rKaec4q6ullkGjr7Efs-U3y2dgoD-lsT5eKcYFLo/s1600/43.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaOH80WefT8b2ACG-dHA-juYNfkPXHnnBdi-kF-475VzPRsgvdzQ7wxf4ykyRfPuyCDTwvW_VH9l3VReCHAS7MCPnmLLXstYerho61rKaec4q6ullkGjr7Efs-U3y2dgoD-lsT5eKcYFLo/s400/43.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460831410814781090&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 159px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;6. Passo: O arquivo web.xml, deverá estar, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG1PoXW5aZxYKO_OCsrCFa81SU7eb7ibVlfxO7OMSmcJuEAdONN6eUjG96QUZMNTJ5E9yNpnrl_-sZ1u_t7O9y70K0W_bJIfqn-irFwroeVBY8_jn7qYXTR5MZGkHwQIlFsyZbOZoAMYAl/s1600/44.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhG1PoXW5aZxYKO_OCsrCFa81SU7eb7ibVlfxO7OMSmcJuEAdONN6eUjG96QUZMNTJ5E9yNpnrl_-sZ1u_t7O9y70K0W_bJIfqn-irFwroeVBY8_jn7qYXTR5MZGkHwQIlFsyZbOZoAMYAl/s400/44.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460831712442185826&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 174px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;7. Passo: Agora, iremos implementar a Classe UsuarioMB, conforme a imagem abaixo, restante do código, será mostrado nas imagens seguinte.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZtR76xfqb2tB1CzcHCKouy8fUS9QLyyNm519jvVO24uf5h1cJP57_eh6DJSI6wa4ITlzFVTuaGtgUyuP4TpEC_FcKNT-kXyLwl0eAtG8paYmYDJI2Qx6hqQOcuqINNiX559KCyX5MJ4G0/s1600-h/45.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 0); -webkit-text-decorations-in-effect: none; &quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIMpyLqZrXyMrCfpfz6bzdxr8ZfiDVcjie791sreLxRsKbdaeo4rahnhP1UKAoOTZRQVpIjGRXReBa0M2stm2mG1-EnYItOj40IzLyeDcT1rmfuJVeDJOD89iZPsP0CM2R-Md2QHkHoJ2h/s1600/45.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhIMpyLqZrXyMrCfpfz6bzdxr8ZfiDVcjie791sreLxRsKbdaeo4rahnhP1UKAoOTZRQVpIjGRXReBa0M2stm2mG1-EnYItOj40IzLyeDcT1rmfuJVeDJOD89iZPsP0CM2R-Md2QHkHoJ2h/s400/45.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460831972052088338&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 313px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZtR76xfqb2tB1CzcHCKouy8fUS9QLyyNm519jvVO24uf5h1cJP57_eh6DJSI6wa4ITlzFVTuaGtgUyuP4TpEC_FcKNT-kXyLwl0eAtG8paYmYDJI2Qx6hqQOcuqINNiX559KCyX5MJ4G0/s1600-h/45.png&quot; onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;8. Passo: Continuado, acrescentar o seguinte código na Classe UsuarioMB, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHO6C8kBMPhV66z6QPp93LtvWcieKxv-0_Q3L9CudzPKv-rbs0GS6KgyI1QBroXw4DT5y36jlt37mj1fDb1G14n5TklzlkVDN4wLcYZnxrhPKeDUHm-TxkUtR6gZayqLMhAQu8RhPLVWCP/s1600/46.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHO6C8kBMPhV66z6QPp93LtvWcieKxv-0_Q3L9CudzPKv-rbs0GS6KgyI1QBroXw4DT5y36jlt37mj1fDb1G14n5TklzlkVDN4wLcYZnxrhPKeDUHm-TxkUtR6gZayqLMhAQu8RhPLVWCP/s400/46.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460832439238096034&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 307px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;9. Passo: Por fim, acrescentar o seguinte código na Classe UsuarioMB, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtHO8XdPIxtLgoOaDOuIq64v8h66AjLl9cCoz5IKdJ8B-nRry3gMSVccpJgwFu1nLwaB8FrTpIXznPWO-x1iFXAFDhBOyTeLI6j2rwtkDD_KW9hVBjXKxnL4Ju12HFMY9x-P7QpwF1h5Qu/s1600/47.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtHO8XdPIxtLgoOaDOuIq64v8h66AjLl9cCoz5IKdJ8B-nRry3gMSVccpJgwFu1nLwaB8FrTpIXznPWO-x1iFXAFDhBOyTeLI6j2rwtkDD_KW9hVBjXKxnL4Ju12HFMY9x-P7QpwF1h5Qu/s400/47.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460832707500199730&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 335px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;10. Passo: Agora criaremos o único arquivo jsp.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoMbtLcDzSLTZGYxaBWr8gMThBz_fMGF-OMl89n3V1ZPlWiyWEgHr7vmdgV0KoLSanjgmLbE1kbQNF_VuZYttabwDlwczkpFGi8e170sC0znVq_L-eKg4RCanmaCK6qsBr50G5YWrrfTpL/s1600/48.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhoMbtLcDzSLTZGYxaBWr8gMThBz_fMGF-OMl89n3V1ZPlWiyWEgHr7vmdgV0KoLSanjgmLbE1kbQNF_VuZYttabwDlwczkpFGi8e170sC0znVq_L-eKg4RCanmaCK6qsBr50G5YWrrfTpL/s400/48.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460832915180104946&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 362px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;11. Passo: Na tela seguinte, informe o nome da página jsp.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHaEbMcInJwMnEtsg_Pte8D3MtpP4IwEv9iS5_re18gPXS_1ENhA1XJhtJjTuocZ_fOcG5CUNukNAZ_W_as8LwbHtmKL66Z3ptgzQ37KJcTQ97cuFE2A95LXLfmr7u9hKqHUUOz0TTnRF5/s1600/49.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHaEbMcInJwMnEtsg_Pte8D3MtpP4IwEv9iS5_re18gPXS_1ENhA1XJhtJjTuocZ_fOcG5CUNukNAZ_W_as8LwbHtmKL66Z3ptgzQ37KJcTQ97cuFE2A95LXLfmr7u9hKqHUUOz0TTnRF5/s400/49.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460833240543170642&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 369px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;12. Passo: Na tela seguinte, informe o template do tipo JSF, conforme a abaixo, e clica em finish.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4CeywJqdVI-mCBOj-aKh0CPjWU8xF7SeY2pDNx3tyRtAa_ESqVt4dYGqkn5dTvHVwqPD5z4hJkPPHXWxA3bDTvINsvWyXC5FG0Hy2JS2aDM1YZwQIzrRXgvaixZedo5nn-znbjweyK1pU/s1600/50.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4CeywJqdVI-mCBOj-aKh0CPjWU8xF7SeY2pDNx3tyRtAa_ESqVt4dYGqkn5dTvHVwqPD5z4hJkPPHXWxA3bDTvINsvWyXC5FG0Hy2JS2aDM1YZwQIzrRXgvaixZedo5nn-znbjweyK1pU/s400/50.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460833493774874802&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 372px; height: 368px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;13. Passo: Na página usuario.jsp, deixar conforme a imagem abaixo, o restante do código será mostrado nas imagens seguintes.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlX-GUtLlECcX_FFQSCXQ37ZhxS0_wUDW_vwDU9tSJhNGZurmYQhx-Q8XoDkiEJD671sZmnCcrZWKYV3_jGd3m6gAKudgO8ce7jXiVu8wbxoZR124qkCkm-W_JO11XO0fF0LKXghx_RPwn/s1600/51.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlX-GUtLlECcX_FFQSCXQ37ZhxS0_wUDW_vwDU9tSJhNGZurmYQhx-Q8XoDkiEJD671sZmnCcrZWKYV3_jGd3m6gAKudgO8ce7jXiVu8wbxoZR124qkCkm-W_JO11XO0fF0LKXghx_RPwn/s400/51.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460833743378784178&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 266px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;14. Passo: Na página usuario.jsp, acrescenta o código seguinte, conforme a imagem.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl3efOZglGg8e2z9IpTFiWEj6A48vNxtlKofhojcLGPZN0lCxsf5whoijEomoOkUxKicBoobZ12f7vgun8fTO2I0CkwSitsdk-xHqI8jJFh-sZRpEVm2NjqeTckh85oFgSZvPnmVKyNIIv/s1600/52.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhl3efOZglGg8e2z9IpTFiWEj6A48vNxtlKofhojcLGPZN0lCxsf5whoijEomoOkUxKicBoobZ12f7vgun8fTO2I0CkwSitsdk-xHqI8jJFh-sZRpEVm2NjqeTckh85oFgSZvPnmVKyNIIv/s400/52.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460833966179867746&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 270px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;15. Passo: Por fim, na página usuario.jsp, acrescenta o código seguinte, conforme a imagem.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0PBB7cRYC0qh_DFMNLT7tJGFOn0Al-HArWadTfkIsxRXi1WpylhfRAsth5nryknCgTbRjcTNjUfliLO-VYA_YnCOZ_q-Nq17G6Ajtrw9A9vXmDiOgHd4BO7lxCynzs0e4vYvph9NiR1p2/s1600/53.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0PBB7cRYC0qh_DFMNLT7tJGFOn0Al-HArWadTfkIsxRXi1WpylhfRAsth5nryknCgTbRjcTNjUfliLO-VYA_YnCOZ_q-Nq17G6Ajtrw9A9vXmDiOgHd4BO7lxCynzs0e4vYvph9NiR1p2/s400/53.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460834185368148466&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 329px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;16. Passo: Assim, terminamos nossa aplicação, agora iremos testar.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwvjQgPRgzT0UUgpodwOFR5IY03Q6ZfPsYurIBLomU-w-drbj5vIGCMY_wVZfhXU8-QJQ2JKjX-7BO4tv6-xC1u_jBMQkWc151EWOKYnKlZuqIsEkPvr4xIyq2IidcndgltQ4S9PIfLGyH/s1600/54.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwvjQgPRgzT0UUgpodwOFR5IY03Q6ZfPsYurIBLomU-w-drbj5vIGCMY_wVZfhXU8-QJQ2JKjX-7BO4tv6-xC1u_jBMQkWc151EWOKYnKlZuqIsEkPvr4xIyq2IidcndgltQ4S9PIfLGyH/s400/54.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460834390339785170&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 360px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;17. Passo: Na tela seguinte, escolha o server TomCat e clica em Finish.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYFzsrckXdsSANV3r9LlhVrsT5EJi-RqHGsLIAVULO0UzuxXA8tUOVHp0w3xOWmxP93RUo2o2DFIy0EGHrZ5Y2yWeQRJ0zxrwRSV976Owo7c5q06IgCHOMeukv9WuSM86rajQKV3X2F9tP/s1600/55.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiYFzsrckXdsSANV3r9LlhVrsT5EJi-RqHGsLIAVULO0UzuxXA8tUOVHp0w3xOWmxP93RUo2o2DFIy0EGHrZ5Y2yWeQRJ0zxrwRSV976Owo7c5q06IgCHOMeukv9WuSM86rajQKV3X2F9tP/s400/55.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460834565117721346&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 340px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;18. Passo: Agora, na barra de endereço informe a URL da nossa aplicação e clica para ir, se tudo ocorrer certo, será aberto a seguinte.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKFvt48gTR979o_AIB2jSNsLCbJEaLR9AemVYtqrFKp8JrDINEh1BNnmZ-oaILp9j7TuMCay4Dz6mfRxEdK-Reaf42zIxrYp98lfDP-ISCHWGjNNqAxtij3y-VJ7Bm26jgBxVqkclG47Lt/s1600/56.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKFvt48gTR979o_AIB2jSNsLCbJEaLR9AemVYtqrFKp8JrDINEh1BNnmZ-oaILp9j7TuMCay4Dz6mfRxEdK-Reaf42zIxrYp98lfDP-ISCHWGjNNqAxtij3y-VJ7Bm26jgBxVqkclG47Lt/s400/56.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460834738959063586&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 194px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;19. Passo: Agora, só testar aplicação, irei cadastrar um novo usuário, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfI_od-QuGFcvq6-IHWAULSSS_3WRG_s7EJ3ml6VgzMi-zcXDSi0vi5oEFsdA6zuTB1ZTAWHpbTOSBkEaKYbzbqF6Poe1WJTUjhwb8OpcPv5roSids_AllhiT1c9cM_NdmcHOm60u7qcOy/s1600/57.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfI_od-QuGFcvq6-IHWAULSSS_3WRG_s7EJ3ml6VgzMi-zcXDSi0vi5oEFsdA6zuTB1ZTAWHpbTOSBkEaKYbzbqF6Poe1WJTUjhwb8OpcPv5roSids_AllhiT1c9cM_NdmcHOm60u7qcOy/s400/57.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460834949672858770&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 397px; height: 382px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;20. Passo: Após ter cadastrados alguns usuários, já podemos ve-lôs, na table.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgypboHM5duGg0_5Aq0VF4Bbu5PugY7FrHmuzTGypd6Jdx_ZxD-zy_kEg3YX3QFYNNNyipFDP3cgMld6bqxW1BbqzsPtuijghVMz7JNa2YmUmLeYJESXt31ShMudlOBzT0vda6nI_166vI/s1600/58.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgypboHM5duGg0_5Aq0VF4Bbu5PugY7FrHmuzTGypd6Jdx_ZxD-zy_kEg3YX3QFYNNNyipFDP3cgMld6bqxW1BbqzsPtuijghVMz7JNa2YmUmLeYJESXt31ShMudlOBzT0vda6nI_166vI/s400/58.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460835115701147330&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 382px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;21. Passo: Podemos excluir um usuário.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfW4ub_5g9rz610XfHbappV5z_rle3-0g8OQt4zd_jNBZTX3DaMzdZItvYw9tploilRCYgpvs8V7ukjiMvIwcPSJ7btdCxmtpgvwWFWxPTQqXlWabbCOdkiXaUPnFAWaWhIVdJkmDiI-f2/s1600/59.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfW4ub_5g9rz610XfHbappV5z_rle3-0g8OQt4zd_jNBZTX3DaMzdZItvYw9tploilRCYgpvs8V7ukjiMvIwcPSJ7btdCxmtpgvwWFWxPTQqXlWabbCOdkiXaUPnFAWaWhIVdJkmDiI-f2/s400/59.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460835338421635634&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 377px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Sendo assim, terminamos nossa aplicação, que envolveu, o uso das melhores tecnologias do mercado. Através do Hibernate, conseguimos trabalhar com objetos e sem a necessidade de ficar digitando SQL, e também o JSF que é um Framework MVC que vem crescendo no mercado, por oferecer uma produtividade incrível. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Quem quiser baixar o projeto completo, &lt;a href=&quot;http://www.4shared.com/file/236234470/da0ec8d8/crud-jsf-hibernate.html&quot;&gt;clica aqui&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Qualquer sugestão, dúvida ou crítica, ficarei a disposição.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/8730411375758771153/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/03/crud-com-jsf-e-hibernate-usando-eclipse.html#comment-form' title='8 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/8730411375758771153'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/8730411375758771153'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/03/crud-com-jsf-e-hibernate-usando-eclipse.html' title='CRUD com JSF e Hibernate usando Eclipse, TomCat e MySQL (Parte 3)'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhTz8HOfygVN9RTPkJ2Gry_HsCdSnA_JUC4boxR9Yoy1Ze7GeXffNS7YO0fUeKhyphenhyphen_USV3tFNZaFoFDWzCLw-hJ6W637oEZR49balwleLCd9nP1CBmsWJQOP3C8NGT4-0dZjmGhW5gLtsSQB/s72-c/39.png" height="72" width="72"/><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-4345666669489466609</id><published>2010-03-07T07:59:00.000-08:00</published><updated>2010-04-23T16:52:54.291-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="Hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="JSF"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="TomCat"/><title type='text'>CRUD com JSF e Hibernate usando Eclipse, TomCat e MySQL (Parte 2)</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Essa é a segunda parte do desenvolvimento de uma simples aplicação para web, usando os Frameworks JSF e Hibernate. Na primeira parte configuramos o servidor TomCat no Eclipse e criamos um novo projeto para web.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Nesta parte iremos construir nossa Classe Bean e a camada de persistência usando o Hibernate.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot; color: rgb(51, 51, 51); line-height: 20px; font-family:Arial, Helvetica, sans-serif;&quot;&gt;&lt;i&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;Ao final do post, o projeto será disponibilizado para download, para quem quiser baixar e testar.&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1.  Passo: Clica com o botão direito do mouse sobre o projeto e escolha new -&gt; Class.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTE3nCmg5mynhS8ayWLT8KmWHHxnP7hPCBaLK6XL_OFe15UC8U2Bc4dysDgRdHTpWfan7E1JEQ7zqUiX8XNXde-EDbtX1BiqgWQ_oj0cbUADJUly3DLIkex-Oujctc8MH5Q402mtRir0vg/s1600/12.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTE3nCmg5mynhS8ayWLT8KmWHHxnP7hPCBaLK6XL_OFe15UC8U2Bc4dysDgRdHTpWfan7E1JEQ7zqUiX8XNXde-EDbtX1BiqgWQ_oj0cbUADJUly3DLIkex-Oujctc8MH5Q402mtRir0vg/s400/12.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460822963841524946&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 399px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2.  Passo: Informe o nome do pacote e da Classe conforme a figura abaixo e clica em finish.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLTPsbzj1LZ0eSwdBGcahXQzu00iSXCHkvNgNU2RgnG0yM9es1MEIbNmaUG__nqcmlG4JWojEEIZLQYFoRm6n5WEI8BGOmD4M7HDLxoK3ZDZX0j3lwdAi4uHJ6u6WVGkY6znpQfPmXxPbh/s1600/13.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjLTPsbzj1LZ0eSwdBGcahXQzu00iSXCHkvNgNU2RgnG0yM9es1MEIbNmaUG__nqcmlG4JWojEEIZLQYFoRm6n5WEI8BGOmD4M7HDLxoK3ZDZX0j3lwdAi4uHJ6u6WVGkY6znpQfPmXxPbh/s400/13.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460823179306953810&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 362px; height: 391px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;3.  Passo: Deixa a classe Usuario como mostrado abaixo, com os atributos e seus respectivos métodos get e set.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiIs8tBYwHgFsPQH51GPMC5qF7VjnndXb697__WV6AqeRRmRbb0c5LHT7YSGxI4OUl5D-tiuYYVNpAJNZ2h1CLPlAJHMkVN3nnyMqciqTYbPKaYUArwvgj-dvIh__kQbBUJCIPMyNJWbR9/s1600/14.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiIs8tBYwHgFsPQH51GPMC5qF7VjnndXb697__WV6AqeRRmRbb0c5LHT7YSGxI4OUl5D-tiuYYVNpAJNZ2h1CLPlAJHMkVN3nnyMqciqTYbPKaYUArwvgj-dvIh__kQbBUJCIPMyNJWbR9/s400/14.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460823367056388770&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 352px; height: 342px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;4. Passo: Agora criaremos nosso arquivo de configuração do Hibernate, para isto clica com o botão direito do mouse sobre o projeto e escolha New -&gt; XML.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj78R0MXL3cBNr0A_gicAc7S_gBJ5iTtFrD2On4xKlVaCe9O2Z_Mb6SqiXiQtL7bmUbu9jXT7hsgg5XVkNbm7r5mzo9ScrbX6NLCKu58CYJSWEgV1RXJNXdQLRlm9bB1p0XjSY8zz75mBfC/s1600/15.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj78R0MXL3cBNr0A_gicAc7S_gBJ5iTtFrD2On4xKlVaCe9O2Z_Mb6SqiXiQtL7bmUbu9jXT7hsgg5XVkNbm7r5mzo9ScrbX6NLCKu58CYJSWEgV1RXJNXdQLRlm9bB1p0XjSY8zz75mBfC/s400/15.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460823550819365442&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 363px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;5. Passo: Informe o nome do arquivo XML de acordo com a imagem abaixo e clica em finish.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkK_kG1oWLwVdktBUohUSqvIGo1Nf3Y0DFRNFc-bEUtwpLZqIPNgEUiX23qaHB3rkiCBg3V-yWTrrtLU3_Yrj-jKvDCFpYpaaUmehQsbLqda37c-JS4M_pcBLnkvNgF0GbXd3QhIRUiWYb/s1600/16.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkK_kG1oWLwVdktBUohUSqvIGo1Nf3Y0DFRNFc-bEUtwpLZqIPNgEUiX23qaHB3rkiCBg3V-yWTrrtLU3_Yrj-jKvDCFpYpaaUmehQsbLqda37c-JS4M_pcBLnkvNgF0GbXd3QhIRUiWYb/s400/16.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460823864341949234&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 379px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;6. Passo: Deixa o arquivo de configuração conforme está a imagem abaixo, não esquece de mudar o nome do seu banco de dados e também o nome de usuário e senha. Também deixa este arquivo dentro do pacote util, caso tenha este pacote, criar um.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNRUZOImgqX6QB3TBJhny0Bn4IrBZhB9eVNvQIA2CqgbDpwn9zZyuv2OVkEM5M5EugewDyGvjW4XBU5eKrU7YJFUP61w_EOZS4WMY-9jNHAnbpMw5i_iMWytqNceQnpWYayBw2oZg65Z-b/s1600/17.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNRUZOImgqX6QB3TBJhny0Bn4IrBZhB9eVNvQIA2CqgbDpwn9zZyuv2OVkEM5M5EugewDyGvjW4XBU5eKrU7YJFUP61w_EOZS4WMY-9jNHAnbpMw5i_iMWytqNceQnpWYayBw2oZg65Z-b/s400/17.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460824082963616946&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 218px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;7. Passo: Agora criaremos uma Classe que servirá para gerar tabelas no banco de dados MySQL.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu_esDv9yM7XHvkk_zxTmTUlTvxqKHR65CyUdiDk3S0c4cBMikFaDp7EYgN_3bia-mih2SUoLxjPdaa79KHVTwEUT-jSc1GtMjGjjcbANb_PjzYBbQw9IJpFoWvezqn3_p_lN6XjitNCv_/s1600/18.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgu_esDv9yM7XHvkk_zxTmTUlTvxqKHR65CyUdiDk3S0c4cBMikFaDp7EYgN_3bia-mih2SUoLxjPdaa79KHVTwEUT-jSc1GtMjGjjcbANb_PjzYBbQw9IJpFoWvezqn3_p_lN6XjitNCv_/s400/18.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460824379024886674&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 394px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;8. Passo: Agora informe o nome da Classe e o pacote, deixando habilitado o método main, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFEQDGa4_sOrXSDP5_-sWJBnydr1UYRlgZ8jVhGVQq8HJL7hkXMCZRnh0VnYe8AJLDejJCwN32qmB6L7-rw29I9hH8AV9mBMj2VonuaTy27Us81BVfqypOL26qOympJEofYCHZvFaWRvSH/s1600/19.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiFEQDGa4_sOrXSDP5_-sWJBnydr1UYRlgZ8jVhGVQq8HJL7hkXMCZRnh0VnYe8AJLDejJCwN32qmB6L7-rw29I9hH8AV9mBMj2VonuaTy27Us81BVfqypOL26qOympJEofYCHZvFaWRvSH/s400/19.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460824656650825618&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 371px; height: 387px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;8. Passo: Deixa a Classe GerarTabelas conforme está na imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXg2-JdJfmEdQ5XQIjdxcB6qC6b1YBk3FXCzzUlcKeXstpji403I5XKNOMBkOIFOH90u97Rat8t5RvcqSnVdeU061lufk7kUm8KoEC4KCkKJ2jt6gj5_qyvW6KM-tZQeDLNM2SrYlf565M/s1600/20.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXg2-JdJfmEdQ5XQIjdxcB6qC6b1YBk3FXCzzUlcKeXstpji403I5XKNOMBkOIFOH90u97Rat8t5RvcqSnVdeU061lufk7kUm8KoEC4KCkKJ2jt6gj5_qyvW6KM-tZQeDLNM2SrYlf565M/s400/20.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460824860487078946&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 243px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;9. Passo: Agora iremos executar esta Classe para gerar a tabela USUARIO, para isto, faça conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOT6u1fzggHFViqPwyZGSH9wbX3vxXz3HowMsztEqHglt6BpMaoB4TYBq64ovlKp9cwcN5YJi8QQMUBHs4mxdVSLj-6t8qx66BtDnZNba0BLHc9QS-9egiUrWd1wiIjQ7-qRp2sSelimH2/s1600/21.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjOT6u1fzggHFViqPwyZGSH9wbX3vxXz3HowMsztEqHglt6BpMaoB4TYBq64ovlKp9cwcN5YJi8QQMUBHs4mxdVSLj-6t8qx66BtDnZNba0BLHc9QS-9egiUrWd1wiIjQ7-qRp2sSelimH2/s400/21.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460825185747182482&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 279px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;10. Passo: Se tudo ocorreu certo, a tabela foi gerado com sucesso conforme o log da imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYV21jm1AP8qSkaEZujJ7R6RQjAn5EFFInz52sFFCUF0PhbyD1hTigxYTYJYVZ5p843ROjUnl3d0KfRzR-bwt-FjCOJFPwTbkBYvs9fkIPO1v5YB4dvzyy7XIeqAk-GIPnCqjL468uFzSs/s1600/22.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYV21jm1AP8qSkaEZujJ7R6RQjAn5EFFInz52sFFCUF0PhbyD1hTigxYTYJYVZ5p843ROjUnl3d0KfRzR-bwt-FjCOJFPwTbkBYvs9fkIPO1v5YB4dvzyy7XIeqAk-GIPnCqjL468uFzSs/s400/22.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460825438562582674&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 364px; height: 145px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;11. Passo: Agora criaremos uma nova Classe.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTCbzIEAOSf_OFt-b_mRB5wRoZj-NF9o_jwmQcnfKAvFxMYmqUtozmGIvH_fEFotj7R3QMQHjDiV1KDCuYPe1M76FXtPkPqFkjvRo0udsdO8FpgcdfJoy2_T0dMu0DO7TLgn_Os-EF9_sq/s1600/23.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTCbzIEAOSf_OFt-b_mRB5wRoZj-NF9o_jwmQcnfKAvFxMYmqUtozmGIvH_fEFotj7R3QMQHjDiV1KDCuYPe1M76FXtPkPqFkjvRo0udsdO8FpgcdfJoy2_T0dMu0DO7TLgn_Os-EF9_sq/s400/23.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460825645355526146&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 394px; height: 386px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a onblur=&quot;try {parent.deselectBloggerImageGracefully();} catch(e) {}&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqZXdKBXZPR3RewhDlPykLpwqS9eJkBwgk1I_XOxWzQcNRXIHQJ_pOyL-pckKZWtkQOkr99VKFbrFrgOMNkiaCCa-xvZaHikSW3M0NQ-2b94oeHgb4SqXZesw9DtvulW6KTQAcoqvHxccH/s1600-h/25.png&quot;&gt;&lt;br /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;12. Passo: Informe o nome do pacote e da Classe, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW2I2OVINY4HutiOEk9K0j8K0OYsFHnGYjKZO0s71rpMb4yc-m-FXpRDohQTfKW2h6k8giyOQ87JUcyqgba1gV8T4QG-3kvamOn_jpMsjeeP-QLh2M8KRDcIEqvzbxJ0gXD2XLtDl-bVKO/s1600/24.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjW2I2OVINY4HutiOEk9K0j8K0OYsFHnGYjKZO0s71rpMb4yc-m-FXpRDohQTfKW2h6k8giyOQ87JUcyqgba1gV8T4QG-3kvamOn_jpMsjeeP-QLh2M8KRDcIEqvzbxJ0gXD2XLtDl-bVKO/s400/24.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460825896736517186&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 357px; height: 384px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;13. Passo: Deixa a Classe HibernateUtil conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_mdxFVcFEyKhQDoH_0b9AwnjU01afFKq0OHK5DqkpzqfruV-gnJM5xVf3xrCXOC5TqK5_0Iidqtl_e9GKuddxVkVIlauoSustpcS1u328MFMVql-L9dWRqiyZbafz-IZ63hkkgty7Pgsv/s1600/25.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_mdxFVcFEyKhQDoH_0b9AwnjU01afFKq0OHK5DqkpzqfruV-gnJM5xVf3xrCXOC5TqK5_0Iidqtl_e9GKuddxVkVIlauoSustpcS1u328MFMVql-L9dWRqiyZbafz-IZ63hkkgty7Pgsv/s400/25.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460826156954919842&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 242px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;14. Passo: Criaremos agora Interface DAO.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvxmjcLvvTdRxEc7OtGywrVISkQEAYY5COBUCvifvinaIEuHvaBqwJXLsz1Rk2RfcNpFCBTmfcQHDxzY6XU_8KUOI1a6INJ9QfnCQ0mmVzrdqIzQvfwiUF26Z6nPAS2Z2Kqh69WyQ5nyv2/s1600/26.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvxmjcLvvTdRxEc7OtGywrVISkQEAYY5COBUCvifvinaIEuHvaBqwJXLsz1Rk2RfcNpFCBTmfcQHDxzY6XU_8KUOI1a6INJ9QfnCQ0mmVzrdqIzQvfwiUF26Z6nPAS2Z2Kqh69WyQ5nyv2/s400/26.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460826397462135778&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 290px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;15. Passo: Informe o nome da Interface e o seu pacote, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVyPbQYdQEFFNNIGhToHCil4caClUaL2EqMq3W9cE2dycEaLT1MIVLSMFLy3o27k6MaYaVSIGCP58HMGePqaeva8nryNFhf3Yk-0Iar-YP0V61mSpDTkA7357kwRoqMVfxB0PTzPhRcg_7/s1600/27.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVyPbQYdQEFFNNIGhToHCil4caClUaL2EqMq3W9cE2dycEaLT1MIVLSMFLy3o27k6MaYaVSIGCP58HMGePqaeva8nryNFhf3Yk-0Iar-YP0V61mSpDTkA7357kwRoqMVfxB0PTzPhRcg_7/s400/27.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460826731697680002&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 373px; height: 314px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;16. Passo: Agora informe os nomes dos métodos abstrato, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixQC9DjSWh4Fepv-szCcgHfrhU1XVSUWweoJTmi_FpemBL_o15dSiDjnpJKoQx_joZ82rozeqWdtBru6fUfejFClVzmgNFQQ7ta7xFOsYGnoSMTxt2ko3IuAA3sKt32DeMEXHw_JeTROPb/s1600/28.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEixQC9DjSWh4Fepv-szCcgHfrhU1XVSUWweoJTmi_FpemBL_o15dSiDjnpJKoQx_joZ82rozeqWdtBru6fUfejFClVzmgNFQQ7ta7xFOsYGnoSMTxt2ko3IuAA3sKt32DeMEXHw_JeTROPb/s400/28.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460826943908461586&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 325px; height: 276px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;17. Passo: Crie agora uma nova Classe.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLb4dwW5py8_iwzrKycxvuVSQelkGkbwtVhm5S7kLGaJb_Qya26IBNp1GNBuRa_tW1HUSHt1aFj5bqUcTukvO4ncSOZDpYUrMqWooI4RIG-4EMK64wz87_cidGkND7-xXeJwbHUSpAAmLa/s1600/29.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLb4dwW5py8_iwzrKycxvuVSQelkGkbwtVhm5S7kLGaJb_Qya26IBNp1GNBuRa_tW1HUSHt1aFj5bqUcTukvO4ncSOZDpYUrMqWooI4RIG-4EMK64wz87_cidGkND7-xXeJwbHUSpAAmLa/s400/29.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460827254973239714&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 384px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;18. Passo: Informe o nome da Classe e do Pacote, não esquece de informar a Interface que a Classe vai implementar, que no caso é UsuarioDAO, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpSW1qP_m5aIRWXASwiMuvfBUNOmJbOouRDt0A_rF5Jms2nIML0SVRgHTT73P3IqYy3uOBlPYXdGApnNAlK_2V3DSwQgz_8Td7naJFXpwNCQRs0C5tgd11Cp8yHyHb3HP6pceQxcnpdorY/s1600/30.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpSW1qP_m5aIRWXASwiMuvfBUNOmJbOouRDt0A_rF5Jms2nIML0SVRgHTT73P3IqYy3uOBlPYXdGApnNAlK_2V3DSwQgz_8Td7naJFXpwNCQRs0C5tgd11Cp8yHyHb3HP6pceQxcnpdorY/s400/30.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460827578435930754&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 374px; height: 395px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;19. Passo: Agora informe os atributos da Classe, e a implementação do método insereUsuario, conforme a imagem abaixo, os outros métodos serão informados mais adiante.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpFivwtcTOz70CTGV1igDgq6y9s7DB4r9LS-7kIljstF0XLHHj2-F9mvzfef1TGwei9PUfifk5xK3naW59Oge97iWkbhwcf3ysJtasrIFTRN2FGZQkfzWNdOgSA7k32q6MAnaAMNoI_dJk/s1600/31.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgpFivwtcTOz70CTGV1igDgq6y9s7DB4r9LS-7kIljstF0XLHHj2-F9mvzfef1TGwei9PUfifk5xK3naW59Oge97iWkbhwcf3ysJtasrIFTRN2FGZQkfzWNdOgSA7k32q6MAnaAMNoI_dJk/s400/31.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460828229211673666&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 395px; height: 343px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;20. Passo: Implementa agora o método alteraUsuario e excluiUsuario, conforme a imagem abaixo, agora só falta mais dois métodos.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4voPc0tMm9xRrVi2GrSsuoQ3NUCiCSSfUm3MEB-MNrn-cCmvnZgsA5JSZN9e58xubCHow7z0t7f9FI_ivn3ocO5mX56L6onwaTI7aMnx4DIqNUJ3mQ6GLs6I_uhjk8ZeScJPXN8ObmdBY/s1600/32.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4voPc0tMm9xRrVi2GrSsuoQ3NUCiCSSfUm3MEB-MNrn-cCmvnZgsA5JSZN9e58xubCHow7z0t7f9FI_ivn3ocO5mX56L6onwaTI7aMnx4DIqNUJ3mQ6GLs6I_uhjk8ZeScJPXN8ObmdBY/s400/32.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460828430929478994&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 394px; height: 362px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;21. Passo: Finalizamos a Classe UsuarioDAOImp com os métodos procuraUsuario e procuarTodosUsuarios, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXOkD2RKpxoOj9PFf7ibPK92VEJUu2s-qHnGWJ-HaEX4GsT6y6v91CEmzjI8GBj9BcVkQ8gKE5pwJaAGNtFf2Gt71jYDSg2wbOmKa-PqbBVFie9PYfaJt3UIf2OsGzKPav_yptw9bD53_9/s1600/33.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXOkD2RKpxoOj9PFf7ibPK92VEJUu2s-qHnGWJ-HaEX4GsT6y6v91CEmzjI8GBj9BcVkQ8gKE5pwJaAGNtFf2Gt71jYDSg2wbOmKa-PqbBVFie9PYfaJt3UIf2OsGzKPav_yptw9bD53_9/s400/33.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460828671363547842&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 310px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;22. Passo: Agora criaremos uma Classe para testar nossa camada de persistência.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr9mjHcK3iN8kEoI0PDRHW2Z7UHGpJjmGlxFGqSkLFfeIKeXpZbFTU7f6M_tn4L4MwFPK-vaA0STByf7QA-F_UUtDMJy5jFaxCEvkP5XY0TIRaQrFXDZnapY9Inz2Joq5MAzBKMU5iJXBw/s1600/34.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhr9mjHcK3iN8kEoI0PDRHW2Z7UHGpJjmGlxFGqSkLFfeIKeXpZbFTU7f6M_tn4L4MwFPK-vaA0STByf7QA-F_UUtDMJy5jFaxCEvkP5XY0TIRaQrFXDZnapY9Inz2Joq5MAzBKMU5iJXBw/s400/34.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460828859419500962&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 278px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;23. Passo: Informe o nome da Classe e do Pacote, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvfa5R_3epqu8Cpy8kPYQdMtPJLWRbHVuWhIJy4uMimZix5u9gIabx1-xtz7O7rlFWWJdv3_eUUgPHiA9xBbnQOwZ44QHkNvaBsbu_gSu6urWvclLm_2gz3hK74to0y1bfUHGD_AkJwdDG/s1600/35.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvfa5R_3epqu8Cpy8kPYQdMtPJLWRbHVuWhIJy4uMimZix5u9gIabx1-xtz7O7rlFWWJdv3_eUUgPHiA9xBbnQOwZ44QHkNvaBsbu_gSu6urWvclLm_2gz3hK74to0y1bfUHGD_AkJwdDG/s400/35.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460829040994974834&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 394px; height: 392px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;24. Passo: Deixa a Classe Teste como descrito abaixo, não esqueça de selecionar o método main.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-OuCJBzoFJDqP2WQlqpRCgcRWDFwDY0gjyXzLq2RoC49DL45x8xxgpLfI9ey_4Hva7sq17tikUwrhBL5-7mzSBE50-ZK7EidrBTun8mIakDnC1aogSIP2DoxlQBylAVWYE8a1DLpd9xB4/s1600/36.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-OuCJBzoFJDqP2WQlqpRCgcRWDFwDY0gjyXzLq2RoC49DL45x8xxgpLfI9ey_4Hva7sq17tikUwrhBL5-7mzSBE50-ZK7EidrBTun8mIakDnC1aogSIP2DoxlQBylAVWYE8a1DLpd9xB4/s400/36.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460829256037069234&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 263px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;25. Passo: Iremos agora executar a Classe.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2CN7QgByutuzmuWSnm-CM6mavtUOJMr5ZMTDMSLkrvk31CQDuZ0i_yaGjQQPwZ3dCB9fBGje_45aQzW1wNzeoVaAIu-L73TH5prVny4dXenXasJUjUAZGhiZoTE1Ot2pjuJcGaynDLPcZ/s1600/37.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2CN7QgByutuzmuWSnm-CM6mavtUOJMr5ZMTDMSLkrvk31CQDuZ0i_yaGjQQPwZ3dCB9fBGje_45aQzW1wNzeoVaAIu-L73TH5prVny4dXenXasJUjUAZGhiZoTE1Ot2pjuJcGaynDLPcZ/s400/37.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460829477188671858&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 238px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;26. Passo: Se tudo ocorreu certo, o log do server, ficará, conforme a imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMXRyLNbwDHW-INjivUA3BBYgJeiwAoa3eZb-G7TGyZzeyxzgTEh4Lfa1BGf2NaadFqstnpmQ8Jg38bh9pZQMPPI4OYID4TTubM3nSqKDF7ESs2dLGBn-lA83ED650wXdukBpxs7dPnF4m/s1600/38.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMXRyLNbwDHW-INjivUA3BBYgJeiwAoa3eZb-G7TGyZzeyxzgTEh4Lfa1BGf2NaadFqstnpmQ8Jg38bh9pZQMPPI4OYID4TTubM3nSqKDF7ESs2dLGBn-lA83ED650wXdukBpxs7dPnF4m/s400/38.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460829780569690146&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 337px; height: 228px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Por aqui, finalizamos no segunda parte do desenvolvimento da nossa aplicação para web, na próxima e última parte, criamos a camada de visão, que será implementado pelo Framework JSF.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/4345666669489466609/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/03/crud-com-jsf-e-hibernate-usando-eclipse_07.html#comment-form' title='6 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/4345666669489466609'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/4345666669489466609'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/03/crud-com-jsf-e-hibernate-usando-eclipse_07.html' title='CRUD com JSF e Hibernate usando Eclipse, TomCat e MySQL (Parte 2)'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTE3nCmg5mynhS8ayWLT8KmWHHxnP7hPCBaLK6XL_OFe15UC8U2Bc4dysDgRdHTpWfan7E1JEQ7zqUiX8XNXde-EDbtX1BiqgWQ_oj0cbUADJUly3DLIkex-Oujctc8MH5Q402mtRir0vg/s72-c/12.png" height="72" width="72"/><thr:total>6</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-2018694900978240468</id><published>2010-03-06T16:22:00.000-08:00</published><updated>2010-04-16T12:39:26.904-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="Hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="JSF"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="TomCat"/><title type='text'>CRUD com JSF e Hibernate usando Eclipse, TomCat e MySQL (Parte 1)</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Este post tem como objetivo, desenvolver uma aplicação completa para web utilizando o Hibernate que é Framework completo para o gerenciamento de persistência de dados em Java, e o JSF que é um Framework para desenvolvimento de aplicações web. Esta aplicação contém o cadastro, alteração, exclusão e listagem de usuários, utilizando a IDE Eclipse em conjunto o servidor TomCat 6 e o banco de dados MySQL. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Quem ainda não tem os recursos necessários para desenvolver a aplicação, basta baixa-lás.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Eclipse (&lt;a href=&quot;http://www.eclipse.org/&quot;&gt;http://www.eclipse.org/&lt;/a&gt;).&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;TomCat (&lt;a href=&quot;http://tomcat.apache.org/&quot;&gt;http://tomcat.apache.org/&lt;/a&gt;).&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;MySQL: (&lt;a href=&quot;http://www.mysql.com/&quot;&gt;http://www.mysql.com/&lt;/a&gt;).&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Também é preciso baixar o hibernate, que pode ser encontrado no site &lt;a href=&quot;https://www.hibernate.org/&quot;&gt;www.hibernate.org&lt;/a&gt;, baixar o JSF 1.2, no site &lt;a href=&quot;http://java.sun.com/javaee/javaserverfaces/&quot;&gt;http://java.sun.com/javaee/javaserverfaces/&lt;/a&gt; e por fim, baixar o jar do MySQL, neste site &lt;a href=&quot;http://dev.mysql.com/downloads/connector/j/&quot;&gt;http://dev.mysql.com/downloads/connector/j/&lt;/a&gt;. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Após ter baixados todos os arquivos, copiar os .jar do hibernate, jsf e mysql para a pasta lib do TomCat.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Para começar, abre seu Eclipse e escolha seu workspace, com ele aberto seguiremos as seguintes etapas que estão ilustradas nas imagens. (para uma melhor visualização das imagens basta clicar nelas para expandir o tamanho).&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;   style=&quot;font-family:Arial, Helvetica, sans-serif;color:#333333;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;line-height: 20px; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;font-size:medium;&quot;&gt;&lt;i&gt;Ao final do post, o projeto será disponibilizado para download, para quem quiser baixar e testar.&lt;/i&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. Passo: Configuração do Servidor TomCat no Eclipse, para isto iremos adicionar um novo server.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 0); &quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGCC_Dux0oxoe3RrDi20ju-9SsCRqw4-RXV2o0oke8-ikVq9WfwQ5N-HL5rmwHh9BtfZbX-Rk-gfRALVGebtVOM-hMH_0cXo0GM4GdumWPbMmKJV1gnZFTOg-4XDk0zSsRBj1mi3oHJIFz/s1600/1.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGCC_Dux0oxoe3RrDi20ju-9SsCRqw4-RXV2o0oke8-ikVq9WfwQ5N-HL5rmwHh9BtfZbX-Rk-gfRALVGebtVOM-hMH_0cXo0GM4GdumWPbMmKJV1gnZFTOg-4XDk0zSsRBj1mi3oHJIFz/s400/1.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460820188580528818&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 126px; &quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-text-decorations-in-effect: underline; &quot;&gt;2. Passo: Escolheremos o servidor TomCat na versão 6.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwysDTPxHSqB24SdZ41pfB6SmQkt08rZBXh3mb6y02sa1sdm6ysLZQ93B2fx2oyvG0H5Xg8S2ovnUlyBm7CBwNun2Qo9KrUZQl7dy9B3ItKLmlHzaen7m4YqzVU4gbUBVAE-qz4SV00qh0/s1600/2.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwysDTPxHSqB24SdZ41pfB6SmQkt08rZBXh3mb6y02sa1sdm6ysLZQ93B2fx2oyvG0H5Xg8S2ovnUlyBm7CBwNun2Qo9KrUZQl7dy9B3ItKLmlHzaen7m4YqzVU4gbUBVAE-qz4SV00qh0/s400/2.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460820462292976306&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 391px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-text-decorations-in-effect: underline; &quot;&gt;3. Passo: Clica em Browse.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhD2ZGyCpDm1lO77SGheICTyFWp8tCXvcNjQJJejAXG7Mgi37kIwgO7lZbg9Yh2enN1FFDkupFHeAjtJVp5zNrd_qLRh22qju9O-kQ9WY30DZ32Ux01KRQA_wunCYsoEHjNDi96ijy9v-q/s1600/3.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjhD2ZGyCpDm1lO77SGheICTyFWp8tCXvcNjQJJejAXG7Mgi37kIwgO7lZbg9Yh2enN1FFDkupFHeAjtJVp5zNrd_qLRh22qju9O-kQ9WY30DZ32Ux01KRQA_wunCYsoEHjNDi96ijy9v-q/s400/3.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460820728535161618&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 389px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#0000EE;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#000000;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-text-decorations-in-effect: underline; &quot;&gt;4. Passo: Escolhemos onde está diretório do TomCat.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLa7i0ELWmXMer4sRGxSMmmgIECZ64AaGxoIOXzrJUuf_oPdhsFYGCXJg9XpCK9oHSlvN3-qQKqpufDkS5vYIQtVbHE3ThKq2odMqV_sv_ePnG97r06YJTjMdRRxYtzTz9_2UyeqmCKH8h/s1600/4.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiLa7i0ELWmXMer4sRGxSMmmgIECZ64AaGxoIOXzrJUuf_oPdhsFYGCXJg9XpCK9oHSlvN3-qQKqpufDkS5vYIQtVbHE3ThKq2odMqV_sv_ePnG97r06YJTjMdRRxYtzTz9_2UyeqmCKH8h/s400/4.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460820878723200818&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 385px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;-webkit-text-decorations-in-effect: underline; &quot;&gt;5. Passo: O TomCat foi encontrado com sucesso.&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 238); -webkit-text-decorations-in-effect: underline; &quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAyOx-8FzwLi__l6cu9wZw1uAcoXGkdq-hXIV2UCocqIv7CTSOfINubxNAxOVMVDasRPlFDBgAo1jzl4MhtQUvU7GpfyIKzBn_BdaorqW8dx_iajKc-aMn32z4R0cZMKz1055OGenm8V-x/s1600/5.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAyOx-8FzwLi__l6cu9wZw1uAcoXGkdq-hXIV2UCocqIv7CTSOfINubxNAxOVMVDasRPlFDBgAo1jzl4MhtQUvU7GpfyIKzBn_BdaorqW8dx_iajKc-aMn32z4R0cZMKz1055OGenm8V-x/s400/5.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460821032894425026&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 392px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#0000EE;&quot;&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;6. Passo: O servidor TomCat é listado na guia Server do Eclipse.&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot;  style=&quot;color:#0000EE;&quot;&gt;&lt;u&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: rgb(0, 0, 0); -webkit-text-decorations-in-effect: none; &quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhH-7lhzv9pkI6yLc0XNWWUT0zdDQtRJhT49YdMK0kBxpiC2G97Y1aI8KGLid829A_A_zuAzcJ0tAgtKeus2SZ0QoHRKn67Ym1_rK6vwTMmtdnHuW5dPmn2ULxKERBmpbSPEaRmsHCr-PFa/s1600/6.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhH-7lhzv9pkI6yLc0XNWWUT0zdDQtRJhT49YdMK0kBxpiC2G97Y1aI8KGLid829A_A_zuAzcJ0tAgtKeus2SZ0QoHRKn67Ym1_rK6vwTMmtdnHuW5dPmn2ULxKERBmpbSPEaRmsHCr-PFa/s400/6.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460821196485891698&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 330px; height: 138px; &quot; /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/u&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;7. Passo: Agora criaremos um novo projeto do tipo Dynamic Web Project.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHj5A8E68U20JnR_W69SZ8kAm74ZqeJKSaXb42US9IBk1XP1SdtwbKkmbnpfdbfBz6pGiBMWmm-xIbvPIzkJmSJDMqPqzp2u2M78iOL7uaMP9XtCVQhKYWnLTAAdQ6-_8-j4MAtp70Ah3P/s1600/7.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHj5A8E68U20JnR_W69SZ8kAm74ZqeJKSaXb42US9IBk1XP1SdtwbKkmbnpfdbfBz6pGiBMWmm-xIbvPIzkJmSJDMqPqzp2u2M78iOL7uaMP9XtCVQhKYWnLTAAdQ6-_8-j4MAtp70Ah3P/s400/7.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460821381595471874&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 350px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;8. Passo: Daremos o nome do projeto de crud-jsf-hibernate, em Target runtime e Configuration deixar como está imagem abaixo.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsxm9NWQz-gYG50BU96Wp7GvtYN3HUjGbTRiAPBzWi4lKG4mhVmZQm0LsCqMJcOHCXAlCG7o9aR2FjIQAy6aiZQM3e8jLZ17v1iKFVTund38OiRt5iLyAGBrxWyzGNUbKf0bVITSYafrHC/s1600/8.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsxm9NWQz-gYG50BU96Wp7GvtYN3HUjGbTRiAPBzWi4lKG4mhVmZQm0LsCqMJcOHCXAlCG7o9aR2FjIQAy6aiZQM3e8jLZ17v1iKFVTund38OiRt5iLyAGBrxWyzGNUbKf0bVITSYafrHC/s400/8.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460821606686036626&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 357px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;9. Passo: Deixar como está e clica em Next.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4spQEkAeuleB1et6xbjve0e-kMlB2ciiNUYyBEcc1zYD-Jei89lwHH9OYHz5H6iKXJ5cXHtYnMges_2qrOiQYaCVZhtajaOKTwjz1OrAA1W4k0-p7HvLEZboX3oMJD6uUJu6fXRnu5gRo/s1600/9.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi4spQEkAeuleB1et6xbjve0e-kMlB2ciiNUYyBEcc1zYD-Jei89lwHH9OYHz5H6iKXJ5cXHtYnMges_2qrOiQYaCVZhtajaOKTwjz1OrAA1W4k0-p7HvLEZboX3oMJD6uUJu6fXRnu5gRo/s400/9.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460821790270591474&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 361px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;10. Passo: Deixar como está e clica em Next.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrxf-e4UcXCXPB6qwHYzIfKbqsHG8e3U9K8pJQEAjgLSVufdxcDjNgSqRhx484Oxf7cnwUvAauFkA5MnZz1FSZ3qKZ3iLNrtAe0KnnRYLGJiSmMo1miFkk7HeyORSBJqI8rbT1dF1_alIE/s1600/10.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrxf-e4UcXCXPB6qwHYzIfKbqsHG8e3U9K8pJQEAjgLSVufdxcDjNgSqRhx484Oxf7cnwUvAauFkA5MnZz1FSZ3qKZ3iLNrtAe0KnnRYLGJiSmMo1miFkk7HeyORSBJqI8rbT1dF1_alIE/s400/10.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460821949078619906&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 361px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;11. Passo: Configurar como está na imagem, preste no mapeamento das URLs.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPhyB1leJs7H-oeFcTn6u8wmaYSrVXlVMkePeo04gb2Q7TJTASgCnte7ydZ_3Gftq7Qu6n6qN_hszkinBgQ6DB_JrSXHpXqHY6Iw9wC5rUbZFEh9CXTmor_E-Wnxw1d08UxCHBt9cR7iWj/s1600/11.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPhyB1leJs7H-oeFcTn6u8wmaYSrVXlVMkePeo04gb2Q7TJTASgCnte7ydZ_3Gftq7Qu6n6qN_hszkinBgQ6DB_JrSXHpXqHY6Iw9wC5rUbZFEh9CXTmor_E-Wnxw1d08UxCHBt9cR7iWj/s400/11.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460822131006725058&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 357px; height: 400px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Já configuramos o TomCat no Eclipse, criamos o projeto e na próxima parte começaremos a criar a Classe Bean e a camada de persistência da Aplicação.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Continua...&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/2018694900978240468/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/03/crud-com-jsf-e-hibernate-usando-eclipse_06.html#comment-form' title='2 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/2018694900978240468'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/2018694900978240468'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/03/crud-com-jsf-e-hibernate-usando-eclipse_06.html' title='CRUD com JSF e Hibernate usando Eclipse, TomCat e MySQL (Parte 1)'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGCC_Dux0oxoe3RrDi20ju-9SsCRqw4-RXV2o0oke8-ikVq9WfwQ5N-HL5rmwHh9BtfZbX-Rk-gfRALVGebtVOM-hMH_0cXo0GM4GdumWPbMmKJV1gnZFTOg-4XDk0zSsRBj1mi3oHJIFz/s72-c/1.png" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-4893076886988320128</id><published>2010-02-15T14:29:00.000-08:00</published><updated>2010-07-15T18:34:48.700-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="Google"/><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="JSP e Servlet"/><title type='text'>Google App Engine (Execute os seus aplicativos da web na infraestrutura do Google)</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Nós sabemos que a Google, sempre está inovando, com diversos serviços utéis e gratuitos. No ano passado ela lançou o serviço Google App Engine, que oferece suporte à linguagem Java, ou seja, podemos executar nossos aplicativos web na infraestrutura da Google.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;O Google App Engine oferece um conjunto completo de desenvolvimento que utiliza tecnologias familiares para criar e hospedar aplicativos da web. O uso inicial será sempre gratuito e se você precisar de mais recursos computacionais, eles estão disponíveis a preços de mercado.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;O Google App Engine oferece este &lt;a href=&quot;http://code.google.com/intl/pt-BR/eclipse/docs/download.html&quot; target=&quot;_blank&quot;&gt;plugin&lt;/a&gt; para o Eclipse, facilitando o uso do serviço.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;Este vídeo mostra como fazer um projeto, usando o Eclipse.&lt;br /&gt;&lt;object width=&quot;560&quot; height=&quot;340&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/P3GT4-m_6RQ&amp;amp;hl=pt_BR&amp;amp;fs=1&amp;amp;&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/P3GT4-m_6RQ&amp;amp;hl=pt_BR&amp;amp;fs=1&amp;amp;&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;560&quot; height=&quot;340&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Eu fiz um Crud usando Servlet, JSP e AJAX no Eclipse, quem quiser ver, visite o site: &lt;a href=&quot;http://jabesfelipe.appspot.com/&quot; target=&quot;_blank&quot;&gt;http://jabesfelipe.appspot.com/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Mais informações, &lt;a href=&quot;http://code.google.com/intl/pt-BR/appengine/&quot; target=&quot;_blank&quot;&gt;clique aqui&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;Fonte: &lt;a href=&quot;http://code.google.com/intl/pt-BR/appengine/&quot; target=&quot;_blank&quot;&gt;http://code.google.com/intl/pt-BR/appengine/&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/4893076886988320128/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/02/google-app-engine-execute-os-seus.html#comment-form' title='2 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/4893076886988320128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/4893076886988320128'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/02/google-app-engine-execute-os-seus.html' title='Google App Engine (Execute os seus aplicativos da web na infraestrutura do Google)'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-3836072687506873766</id><published>2010-02-13T07:10:00.000-08:00</published><updated>2010-07-15T18:33:43.868-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AJAX"/><category scheme="http://www.blogger.com/atom/ns#" term="JQuery"/><category scheme="http://www.blogger.com/atom/ns#" term="JSP e Servlet"/><category scheme="http://www.blogger.com/atom/ns#" term="Netbeans"/><title type='text'>AJAX e JQuery com JSP</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify; &quot;&gt;Esta postagem tem como objetivo, mostrar um exemplo prático de &lt;b&gt;AJAX&lt;/b&gt; e &lt;b&gt;JQuery&lt;/b&gt; com o &lt;b&gt;JSP&lt;/b&gt;. O exemplo é bem simples, teremos uma combobox de estado, quando um estado for selecionado, uma outra combobox de cidade será carregada, quando uma cidade for selecionada, é mostrada uma breve descrição da mesma. O projeto foi desenvolvido no Netbeans 6.8 e no TomCat 6.0.20, para quem quiser baixar o projeto, &lt;a href=&quot;http://www.4shared.com/file/221309277/377c6e71/ajax-jquery-jsp.html&quot; target=&quot;_blank&quot;&gt;clique aqui&lt;/a&gt;.&lt;/div&gt;&lt;div style=&quot;text-align: justify; &quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Imagens:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;a rel=&quot;lightbox&quot; href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU4S5yVVJbrGQFL7nUSVd8jcyXOflpjCoZrSSnSl5bXEHIRd5NszvO0QfCLC1GYW6LJGsS8Xr9TN3Y2o4ORpvB0o8qK1ScZy1AaOYNYABofEiLM6G4AXNjaYcTKSs-oYsgp8x682MQ_PLO/s1600/ajax1.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU4S5yVVJbrGQFL7nUSVd8jcyXOflpjCoZrSSnSl5bXEHIRd5NszvO0QfCLC1GYW6LJGsS8Xr9TN3Y2o4ORpvB0o8qK1ScZy1AaOYNYABofEiLM6G4AXNjaYcTKSs-oYsgp8x682MQ_PLO/s400/ajax1.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460819471227840658&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 114px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;a rel=&quot;lightbox&quot;  href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgS6CjPbuLsvv220im90DOmY2XccMsoGFBy1rlrx8UxhPie_0CGKqsDSqLZrZ-ijw0YmHNNkI6RDgvq_MUz7FPiH2fP4fE_MLZbx1xZ3JDC0ZiLnNKdfhnXgXyk9eJXhnX3eJ9jfyu1c33Q/s1600/ajax2.png&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgS6CjPbuLsvv220im90DOmY2XccMsoGFBy1rlrx8UxhPie_0CGKqsDSqLZrZ-ijw0YmHNNkI6RDgvq_MUz7FPiH2fP4fE_MLZbx1xZ3JDC0ZiLnNKdfhnXgXyk9eJXhnX3eJ9jfyu1c33Q/s400/ajax2.png&quot; border=&quot;0&quot; alt=&quot;&quot; id=&quot;BLOGGER_PHOTO_ID_5460819542016245778&quot; style=&quot;text-align: justify;display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; cursor: pointer; width: 400px; height: 164px; &quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/3836072687506873766/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/02/jsp-com-ajax-e-jquery.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/3836072687506873766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/3836072687506873766'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/02/jsp-com-ajax-e-jquery.html' title='AJAX e JQuery com JSP'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjU4S5yVVJbrGQFL7nUSVd8jcyXOflpjCoZrSSnSl5bXEHIRd5NszvO0QfCLC1GYW6LJGsS8Xr9TN3Y2o4ORpvB0o8qK1ScZy1AaOYNYABofEiLM6G4AXNjaYcTKSs-oYsgp8x682MQ_PLO/s72-c/ajax1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1638425322236587217.post-3924967009180131817</id><published>2010-01-16T18:09:00.000-08:00</published><updated>2010-02-15T14:57:23.270-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Java"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><title type='text'>Instalando o Java 6 no Ubuntu 9.10 por apt-get.</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Olá Pessoal,&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Umas das maneiras mais fácil de instalar o &lt;b&gt;Java&lt;/b&gt; no &lt;b&gt;Ubuntu&lt;/b&gt; é através do apt-get, que é um gerenciador de pacotes usado no Ubuntu, para fazer a instalação, abre uma janela do terminal, e digite o seguinte comando.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;sudo apt-get install sun-java6-jre sun-java6-jdk sun-java6-plugin&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Após terminar a instalação, reinicie o computador, lembrando, que não precisa configurar as variáveis de ambientes, toda esta configuração é feita automaticamente.&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;A pasta onde o Java foi instalado, está localizado no seguinte diretório: &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;code&gt;/usr/lib/jvm/java-6-sun&lt;/code&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://jabesfelipe.blogspot.com/feeds/3924967009180131817/comments/default' title='Postar comentários'/><link rel='replies' type='text/html' href='http://jabesfelipe.blogspot.com/2010/01/instalando-o-java-6-no-ubuntu-910-por.html#comment-form' title='0 Comentários'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/3924967009180131817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1638425322236587217/posts/default/3924967009180131817'/><link rel='alternate' type='text/html' href='http://jabesfelipe.blogspot.com/2010/01/instalando-o-java-6-no-ubuntu-910-por.html' title='Instalando o Java 6 no Ubuntu 9.10 por apt-get.'/><author><name>Jabes Felipe</name><uri>http://www.blogger.com/profile/09130756277447333943</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='31' src='http://4.bp.blogspot.com/-GT1r41AqRyo/Tl7osVA6zBI/AAAAAAAAAvw/80IADQ52Qmg/s220/680049_920.jpg'/></author><thr:total>0</thr:total></entry></feed>