/* * ComandoBuscarProponente.java * * Created on 27 de Junho de 2007, 08:29 * * To change this template, choose Tools | Template Manager * and open the template in the editor. */ package app; import dao.PessoaDAO; import java.io.IOException; import java.util.HashSet; import java.util.Set; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import s3e.Trabalho; import s3e.Pessoa; /** * * @author Tuvax */ public class ComandoInserirProponente implements Comando { /** Creates a new instance of ComandoBuscarProponente */ public ComandoInserirProponente() { } public String executar(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession s = request.getSession(true); Set pessoas = (Set) s.getAttribute("proponentes"); if (pessoas == null){ pessoas = new HashSet(); s.setAttribute("proponentes", pessoas); } Pessoa pessoa = null; String email = request.getParameter("email"); pessoa = PessoaDAO.getInstance().obterPessoaPorEmail(email); if (pessoa == null) { return "/WEB-INF/erroEmail.jsp"; } else{ pessoas.add(pessoa); return "/WEB-INF/InsertProponente.jsp"; } } }