/** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ClienteDAO clienteDAO = new ClienteDAO(); VeiculoDAO veiculoDAO = new VeiculoDAO(); List<Cliente> resultCliente = null; resultCliente = clienteDAO.selectByName(""); ArrayList<String> cidades = veiculoDAO.selectCities(); List<Veiculo> veiculos = veiculoDAO.selectByUf(""); request.setAttribute("resultCliente", resultCliente); request.setAttribute("cidades", cidades); request.setAttribute("veiculos", veiculos); RequestDispatcher view = request.getRequestDispatcher("locacao.jsp"); view.forward(request, response); }
/** @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); boolean error = false; if (request.getParameter("cl_number") == null) { out.println("O número do cliente não pode ficar em branco"); error = true; } if (!error) { long clNumber = Long.parseLong(request.getParameter("cl_number")); ClienteDAO clienteDAO = new ClienteDAO(); Cliente cliente = clienteDAO.selectById(clNumber); request.setAttribute("result", cliente); RequestDispatcher view = request.getRequestDispatcher("cliente.cad.jsp"); view.forward(request, response); } }