@Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String eventid = request.getParameter("eventid");
        HttpSession session = request.getSession();
        session.setAttribute("yourslot", null);//null it out each time
        if (!Utils.isNullOrEmpty(eventid)) {
            int id = Integer.parseInt(eventid);
            EventDAO.Event event = EventDAO.selectEvent(id);
            List<ReservationDAO.Reservation> reservations = ReservationDAO.getAllEventReservations(id);
            Map<Integer, ReservationDAO.Reservation> reservedslots = new HashMap<Integer, ReservationDAO.Reservation>();

            for (ReservationDAO.Reservation r : reservations) {
                reservedslots.put(r.slotnum, r);
            }

            long eventStart = event.startTime.getTime();
            long duration = TimeUnit.MINUTES.toMillis(event.duration);
            SimpleDateFormat formatter = new SimpleDateFormat("h:mm a");
            //to be used to display time of event
            String startDate = new SimpleDateFormat("EEE, MMM d, yyyy").format(event.startTime);
            event.setDate(startDate);

            List<SlotData> slots = new ArrayList<SlotData>();
            for (int i = 0; i < event.numslots; i++) {
                long starttime = eventStart + i * duration;
                long endtime = starttime + duration;

                Timestamp slotstart = new Timestamp(starttime);
                Timestamp slotend = new Timestamp(endtime);
                String formatstart = formatter.format(slotstart);
                String formatend = formatter.format(slotend);
                SlotData data = new SlotData(i, formatstart, formatend);
                ReservationDAO.Reservation reserve = reservedslots.get(i);
                if (reserve != null) {
                    UserDAO.User user = reserve.user;
                    data.user = user;
                }
                slots.add(data);
            }
            UserDAO.User user = (UserDAO.User) session.getAttribute("user");
            int userid = user.id;
            int usertype = user.usertype;
            if (usertype == UserDAO.USER) {
                ReservationDAO.Reservation yourslot = ReservationDAO.getUserReservation(userid, id);
                //long userstarttime = eventStart + yourslot.slotnum* duration;
                //String r = formatter.format(new Timestamp(userstarttime));
                if (yourslot != null) {
                    SlotData data = slots.get(yourslot.slotnum);
                    //Timestamp starttime = yourslot.startTime;
                    //String r = formatter.format(starttime);
                    session.setAttribute("yourslot", data);//the user reserved time representation
                }
            }
            session.setAttribute("event", event);
            session.setAttribute("slots", slots);

            request.getRequestDispatcher("/app/reserve.jsp").forward(request, response);
        }
    }