package cn.edu.nuc.shop.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import cn.edu.nuc.shop.entiry.Forder; import cn.edu.nuc.shop.service.interfaces.ForderService; @Controller @RequestMapping("/forder") public class ForderController { @Autowired private ForderService forderMapper; @RequestMapping(value="/order",method=RequestMethod.GET) public String toorder(){ return "redirect:/order.jsp"; } @RequestMapping(value="/order",method=RequestMethod.POST) public String order(Forder forder,HttpSession session,HttpServletRequest request){ Forder sessionforder = (Forder)session.getAttribute("forder"); int count=0; try { count = forderMapper.insertOrder(forder,sessionforder); } catch (Exception e) { request.setAttribute("msg", "商品数量不足"); return "forward:/msg.jsp"; } System.out.println(forder.getFid()); System.out.println(count+"--------------------------"); request.setAttribute("msg", "提交订单成功"); request.removeAttribute("forder"); session.removeAttribute("forder"); return "forward:/msg.jsp"; } }
最近下载更多
zhufbing LV1
1月29日
yuanchuang LV22
2023年12月28日
微信网友_6680567232876544 LV8
2023年10月10日
SDLFJL LV6
2023年8月17日
微信网友_6436772032335872 LV3
2023年4月17日
2643028272 LV1
2023年3月6日
qwe123456asd LV3
2023年2月3日
3305787467 LV12
2022年11月22日
微信网友_6200823191523328 LV3
2022年11月11日
haha12138 LV2
2022年9月14日