protected void processRequest(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        
        ShoppingListManager shopL = new ShoppingListManager();
        HttpSession session = request.getSession();
        int userId = (Integer)session.getAttribute("userId");
        String name = request.getParameter("List Name");
        
        
        System.out.println("forward to shoplist.jsp");
        RequestDispatcher dispatcher;
        if(request.getParameter("new_list")!= null){
            System.out.println("creating new list");
            try{
                shopL.addNewList(userId,name);
            }
            catch(SQLException e){
                System.out.println(e);
            }
            dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/shoplist.jsp");
            dispatcher.forward(request, response);
        }else if(request.getParameter("delete_list")!= null){
            System.out.println("deleting list");
            try{
                shopL.deleteList(userId, name);
            }
            catch(SQLException e){
                System.out.println(e);
            }
            dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/shoplist.jsp");
            dispatcher.forward(request, response);
            
        }else if(request.getParameter("list")!= null){
            System.out.println("going to list");
            String listName = request.getParameter("list_name");
            session.setAttribute("listName", listName);
            try{
                shopL.getItems();
                
            }
            catch(SQLException e){
                System.out.println(e);
            }
                
                dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/oneShopList.jsp");
                dispatcher.forward(request, response);
                
        }else{
            try{
               shopL.getShopList(userId);
            }
            catch(SQLException e){
                System.out.println(e);
            }
            dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/shoplist.jsp");
            dispatcher.forward(request, response);
        }
        
        
        
//        String[] itemsChecked = request.getParameterValues("items");
//        
//        HttpSession session = request.getSession();
//        String id = (String)session.getAttribute("firstName");
        
//        Users user = new Users();
        
        
        
//        if(itemsChecked != null){
//            for(int x = 0;x<itemsChecked.length;x++){
//                user.addToShopList(id,itemsChecked[x]);
//            }
//        }
        
//        ShopList shoplist = new ShopList();
        
        
//               if(session.getAttribute("")) {
//                   
//               }
//        ArrayList<String> sList = user.getShopList(id);
////        System.out.println(id +", "+sList +"itemschecked " + itemsChecked[0]);
//        request.setAttribute("shopping list", sList );
       
    }