1.购物车功能 //用户最近浏览商品记录把商品的id作为参数来传递,在另一个页面来接收这个参数,然后是创建cookie把这个商品id给保存下来。然后就是页面就会自动保存这个cookie。//显示最近浏览商品 Cookie cookie = new Cookie(& ...
1.购物车功能
//用户最近浏览商品记录
把商品的id作为参数来传递,在另一个页面来接收这个参数,然后是创建cookie把这个商品id给保存下来。然后就是页面就会自动保存这个cookie。
//显示最近浏览商品 Cookie cookie = new Cookie("proHistory", getHistory); response.addCookie(cookie); String myid = cookie.getValue(); //将一个数化为一个List对象,这个方**返回一个ArrayList类型的对象,是把字符串从-号开始分劈 List mylist = Arrays.asList(myid.split("_")); Product pro = null; List<Product> list = new ArrayList<Product>(); //遍历list对象 for (Object item : mylist) { CommodityDaoImpl_Dong cimpl = new CommodityDaoImpl_Dong(); try { pro = cimpl.getById(Integer.parseInt(item.toString()));//一级商品id list.add(pro); request.getSession().setAttribute("slist", list); } catch (NumberFormatException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } request.getRequestDispatcher("/product-view.jsp").forward(request, response); }
海外公司注册、海外银行开户、跨境平台代入驻、VAT、EPR等知识和在线办理:https://www.xlkjsw.com
原标题:易买网部分总结
关键词:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。