@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {

		List<MaintenanceEvent> events = null;
        int mileage = -1;
        String vehicleName = "";
        String task = "";

            try {
                events = this.maintenanceEventRepo.findAllEvents();
            } catch (SQLException e) {
                e.printStackTrace();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            }

        if (req.getParameter("vehicleName") != null) {
            vehicleName = req.getParameter("vehicleName");
            if (vehicleName.isEmpty()) {
                resp.sendError(500, "Error loading maintenance event");
            }
            events = this.maintenanceEventRepo.findEventsForVehicle(vehicleName);
        }

        if (req.getParameter("task") != null) {
            task = req.getParameter("task");
            System.out.println(task);
            if (task.isEmpty()) {
                resp.sendError(500, "Error loading maintenance event");
            }
            events = this.maintenanceEventRepo.findEventsByTask(task);
        }

        if (req.getParameter("mileage") != null) {
            mileage = Integer.parseInt(req.getParameter("mileage"));
            if (mileage == -1) {
                resp.sendError(500, "Error loading maintenance event");
            }
            events = this.maintenanceEventRepo.findEventsByMileage(mileage);
        }
		
        req.setAttribute("events", events);
        getServletContext().getRequestDispatcher("/maintenance/listing.jsp").forward(req, resp);
	}