/** * 生成订单 */ @Action(value="add", className="orderAction", results={ @Result(type="redirectAction", params={"actionName", "view", "oid", "%{oid}"}), @Result(name="input", location="/WEB-INF/jsp/msg.jsp"), @Result(name="login", location="/WEB-INF/jsp/login.jsp") }) public String add() { HttpSession session = ServletActionContext.getRequest().getSession(); Cart cart = (Cart)session.getAttribute(CartAction.SESSION_CART); User user = (User)session.getAttribute(UserAction.SESSION_USER); if(cart == null) { getValueStack().set("errMsg", "购物车为空");; return INPUT; } if(user == null) { getValueStack().set("errMsg", "请先登录"); return "login"; } String oid = os.add(getOrder(cart, user)); getValueStack().set("oid", oid); return SUCCESS; }