/** @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); try { HttpSession session = request.getSession(); if (session.getAttribute("ticket") == null) { response.sendRedirect("Ticket?i=2"); } String usuario = request.getParameter("usuario"); String password = request.getParameter("password"); TicketBean ticket = (TicketBean) session.getAttribute("ticket"); // TicketBean ticket = (TicketBean) request.getParamenter("ticket"); DaoFactory dao = DaoFactory.getDAOFactory(DaoFactory.MYSQL); ClienteDAO clienteDao = dao.getClienteDao(); ClienteBean cliente = clienteDao.login(usuario, password); request.setAttribute("funcion", ticket.getFuncion()); if (cliente == null) { request.setAttribute( "error_mensaje", "Por favor, corrija los siguientes errores de ingreso: Usuario no registrado"); getServletContext().getRequestDispatcher("/web/ticketDatos.jsp").forward(request, response); } else { ticket.setCliente(cliente); session.setAttribute("ticket", ticket); getServletContext() .getRequestDispatcher("/web/ticketMetodoPago.jsp") .forward(request, response); } } catch (Exception e) { out.print(e.getMessage()); } }
public Cliente consultarCliente() throws GenericException { DAOFactory factory = DAOFactory.getDAOFactory(DAOFactory.MYSQL); ClienteDAO cli = factory.getClienteDAO(); return cli.consultarCliente(this); }
public boolean excluir() throws GenericException { DAOFactory factory = DAOFactory.getDAOFactory(DAOFactory.MYSQL); ClienteDAO cli = factory.getClienteDAO(); return cli.excluir(this); }