/** 加入购物车 */ public void addGoodsStore() throws IOException { try { goodStore.setState(0); goodStoreService.saveGoodStore(goodStore); m.put("msg", "1"); ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m)); } catch (Exception e) { e.printStackTrace(); m.put("msg", "-1"); ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m)); } }
public void addGoodsStoredirect() throws IOException { id = Integer.parseInt(ServletActionContext.getRequest().getParameter("id")); goodId = Integer.parseInt(ServletActionContext.getRequest().getParameter("goodId")); count = Integer.parseInt(ServletActionContext.getRequest().getParameter("goodId")); GoodStore goodstore = new GoodStore(); goodstore.setState(1); goodstore.setCount(count); goodstore.setAddressId(id); goodstore.setGoodId(goodId); try { goodStoreService.saveGoodStore(goodstore); m.put("msg", "1"); ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m)); } catch (Exception e) { m.put("msg", "-1"); e.printStackTrace(); ServletActionContext.getResponse().getWriter().write(JSON.toJSONString(m)); } }