public void payBook(HttpServletRequest request, HttpServletResponse response)throws Exception{
		
		HttpSession session = request.getSession();
		String userName = ((User)session.getAttribute("userInfo")).getName();
		BasketDAO bDAO = new BasketDAO();
		Basket basket = new Basket();
		BookDAO bookDAO = new BookDAO();
		ArrayList al = bDAO.querryBasket(userName);
		Iterator iter= al.iterator();
		TradeRecordDAO trDAO = new TradeRecordDAO();
		int userId = ((User)(session.getAttribute("userInfo"))).getId();
		int bookId;
		int tradeNum;
		double sum;
		while(iter.hasNext()){
			
			basket = (Basket)iter.next();
			bookId = basket.getBookId();
			tradeNum = basket.getNumber();
			sum = basket.getTotalPrice();
			TradeRecord td = new TradeRecord();
			td.setBookId(bookId);
			td.setUserId(userId);
			td.setSum(sum);
			td.setTradeNum(tradeNum);
			trDAO.insertRecord(td);
			bookDAO.updateNum(bookId, tradeNum);
		}
		bDAO.deleteBasket("");
		
		response.sendRedirect("/BookShop/servlet/Index?requestType=homePage");
		
	}