支付功能
// 支付功能 @RequestMapping(value = "/pay", method = RequestMethod.POST) public String pay(HttpServletRequest req) { // 此处应该实现购物的整个过程 String result = ""; // 获取用户对象 Tuser tu = (Tuser) req.getSession().getAttribute("tu"); // 获取到选择的鲜花的ID集合 String strs = (String) req.getSession().getAttribute("strs"); // 获取到需要支付的总价 Double sum = (Double) req.getSession().getAttribute("sum"); // 获取到花的数量 Map<String, Integer> flowercount = (Map<String, Integer>) req.getSession().getAttribute("flowercount"); // 获取到花的总价 Map<String, Double> flowersum = (Map<String, Double>) req.getSession().getAttribute("flowersum"); try { userService.buy(tu, strs, sum, flowercount, flowersum); // req.getRequestDispatcher("MainServ").forward(req, resp); result = "forward:goMainpost.do"; } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } return result; }
只是为了更好的团圆...