前台servlet TimeSerITeye - 超凡娱乐

前台servlet TimeSerITeye

2019-01-13 17:38:37 | 作者: 金鹏 | 标签: 存在,购物车,设置 | 浏览: 354

import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import cn.client.biz.PlanOrderBiz; import cn.client.biz.ProductsBiz; import cn.client.biz.impl.PlanOrderBizImpl; import cn.client.biz.impl.ProductsBizImpl; import cn.client.dao.NeCommentDao; import cn.client.dao.NeOrderFatherDao; import cn.client.dao.impl.NeCommentDaoImpl; import cn.client.dao.impl.NeOrderFatherDaoImpl; import cn.entity.PlanOrder; import cn.entity.Products; import cn.client.tool.Tool; public class TimeSer extends HttpServlet { public TimeSer() { super(); public void destroy() { super.destroy(); public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //接纳时设置的编码 request.setCharacterEncoding("utf-8"); //转发时设置的编码 response.setCharacterEncoding("utf-8"); //以 超文本格局 方法转发 response.setContentType("text/html"); //获取了一个输出流 PrintWriter out = response.getWriter(); //产品联表 事务逻辑层 ProductsBiz productsBiz = new ProductsBizImpl(); List Products lbList = productsBiz.listBystatusId(2); request.setAttribute("lbList",lbList); //起浮窗口的数据 HttpSession session = request.getSession(); String username = session.getAttribute("username")!= null ?session.getAttribute("username").toString():null; NeCommentDao neCommentDao = new NeCommentDaoImpl(); PlanOrderBiz planOrderBiz = new PlanOrderBizImpl(); NeOrderFatherDao neOrderFatherDao = new NeOrderFatherDaoImpl(); int commentCount=0;//寄存谈论数 List PlanOrder collectList =null;//寄存收藏夹列表 int collectListSize = 0;//存在收藏夹数量 List PlanOrder cartList = null;//存在购物车列表 int cartListSize = 0;//存在购物车数量 int orderCount = 0;//存在订单数 double carttotaPrice = 0.0;//购物车总价 if(username != null){ commentCount = neCommentDao.getTotalCount(username); collectList = planOrderBiz.planOrderList(username, 1); collectListSize = collectList.size(); cartList = planOrderBiz.planOrderList(username, 2); cartListSize = cartList.size(); orderCount = neOrderFatherDao.getTotalCount(username); carttotaPrice = Tool.totaPrice(username, 2); request.setAttribute("commentCount",commentCount); request.setAttribute("collectList",collectList); request.setAttribute("collectListSize",collectListSize); request.setAttribute("cartList",cartList); request.setAttribute("cartListSize",cartListSize); request.setAttribute("orderCount",orderCount); request.setAttribute("carttotaPrice",carttotaPrice); request.getRequestDispatcher("time.jsp").forward(request, response); out.flush(); out.close(); public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); public void init() throws ServletException {

 

版权声明
本文来源于网络,版权归原作者所有,其内容与观点不代表超凡娱乐立场。转载文章仅为传播更有价值的信息,如采编人员采编有误或者版权原因,请与我们联系,我们核实后立即修改或删除。

猜您喜欢的文章

阅读排行

  • 1

    PHP多态ITeye

    多态,目标,不同
  • 2
  • 3
  • 4

    调用体系程序(转)ITeye

    进程,咱们,程序
  • 5
  • 6

    puttyITeye

    保存,用户名,暗码
  • 7

    1001ITeye

    小数点,个数,位数
  • 8
  • 9
  • 10

    vim装备ITeye

    文件,设置,状况