rafaelvicio

Untitled

Jun 30th, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. package br.com.arena.controller;
  2.  
  3. import javax.faces.application.FacesMessage;
  4. import javax.faces.bean.ManagedBean;
  5. import javax.faces.bean.ViewScoped;
  6. import javax.faces.context.FacesContext;
  7.  
  8. import br.com.arena.dao.PessoaDAO;
  9. import br.com.arena.model.Pessoa;
  10.  
  11. @ManagedBean(name = "LoginMB")
  12. @ViewScoped
  13. public class LoginBean {
  14.  
  15. private Pessoa pessoa = new Pessoa();
  16. private PessoaDAO pessoaDAO = new PessoaDAO();
  17.  
  18. /* public Usuario getUsuario() {
  19. return usuario;
  20. }*/
  21.  
  22. public String efetuaLogin() {
  23. System.out.println("Fazendo login do usuário "
  24. + this.pessoa.getNomeUsuario());
  25.  
  26. boolean existe = new PessoaDAO().existe(this.pessoa);
  27.  
  28. if (existe) {
  29. return "livro?faces-redirect=true";
  30. }
  31.  
  32. return null;
  33. }
  34.  
  35. public Pessoa getPessoa() {
  36. return pessoa;
  37. }
  38.  
  39. public void setPessoa(Pessoa pessoa) {
  40. this.pessoa = pessoa;
  41. }
  42.  
  43. public PessoaDAO getPessoaDAO() {
  44. return pessoaDAO;
  45. }
  46.  
  47. public void setPessoaDAO(PessoaDAO pessoaDAO) {
  48. this.pessoaDAO = pessoaDAO;
  49. }
  50.  
  51.  
  52.  
  53. }
Add Comment
Please, Sign In to add comment