protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
		String code = request.getParameter("ISBN");
		String numberInString = request.getParameter("quantity");
		HttpSession session = request.getSession();
		if (session == null) {
			System.out.println("session is null!");
		} 
		Model model = new Model();
		synchronized (session) {
			Cart theCart = (Cart) session.getAttribute("cart");
			if (theCart==null) {
				theCart = new Cart();
				session.setAttribute("cart", theCart);
			} 
					
			int quantity = 1;	
			try {
				System.out.println(numberInString);
				quantity = Integer.parseInt(numberInString);
			} catch (Exception e) {
				quantity = 1;
			}
			System.out.println("afterCheck:"+quantity);
			Book theBook = model.getBook(code);
			if (theBook==null) {
				throw new Exception("book is null");
			}
			LineItem item = new LineItem(theBook, quantity);
			if (quantity >0) {
				theCart.addItem(item);
			}else if (quantity <=0) {
				theCart.removeItem(item);
			}

			session.setAttribute("cart", theCart);
		}
		String url = "/cart.jsp";
		RequestDispatcher dispatcher = getServletContext()
				.getRequestDispatcher(url);
		dispatcher.forward(request, response);
	}