⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 manageaction.java

📁 JSP实现的在线网络购物系统JAVA程序源码,
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                request.getParameter("content");
        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(
                fileName), "UTF-8");
        osw.write(content, 0, content.length());
        osw.flush();
        osw.close();

        this.genIndexTop();

        return mapping.findForward("doTopEdit");
    }

    public ActionForward toTopEditor(ActionMapping mapping, ActionForm form,
                                     HttpServletRequest request,
                                     HttpServletResponse response) throws
            Exception {
        String fileName = getServlet().getServletContext().getRealPath("/") +
                          "htmlet/top_" + request.getParameter("top_id") +
                          ".htm";

        File f = new File(fileName);
        if (!f.exists()) {
            f.createNewFile();
        }
        //读取排行榜文�?
        BufferedReader br = new BufferedReader(new InputStreamReader(new
                FileInputStream(fileName), "UTF-8"));
        String data = null;
        String content = "";
        while ((data = br.readLine()) != null) {
            content = content + data;
        }
        br.close();

        request.setAttribute("CONTENT", content);
        return mapping.findForward("toTopEditor");
    }

    //推荐�?
    public ActionForward toRecTopManage(ActionMapping mapping, ActionForm form,
                                        HttpServletRequest request,
                                        HttpServletResponse response) throws
            Exception {
        Vector r = new GoodsMgr().getTopByType(1);
        //得到每个排行榜的内容
        GenericVO tvo = null;
        String fileName = null;
        File f = null;
        for (int i = 0; i < r.size(); i++) {
            tvo = (GenericVO) r.elementAt(i);
            fileName = getServlet().getServletContext().getRealPath("/") +
                       "htmlet/rectop_" + tvo.getItem("TOP_ID") + ".htm";
            f = new File(fileName);
            if (!f.exists()) {
                f.createNewFile();
            }
            //读取排行榜文�?
            BufferedReader br = new BufferedReader(new InputStreamReader(new
                    FileInputStream(fileName), "UTF-8"));
            String data = null;
            String content = "";
            while ((data = br.readLine()) != null) {
                content = content + data;
            }
            br.close();
            tvo.add("CONTENT", content);
        }

        request.setAttribute("RESULT", r);
        return mapping.findForward("toRecTopManage");
    }

    public ActionForward toRecTopAdd(ActionMapping mapping, ActionForm form,
                                     HttpServletRequest request,
                                     HttpServletResponse response) throws
            Exception {
        return mapping.findForward("toRecTopAdd");
    }

    public ActionForward doRecTopAdd(ActionMapping mapping, ActionForm form,
                                     HttpServletRequest request,
                                     HttpServletResponse response) throws
            Exception {
        GenericVO gvo = new GenericVO();
        gvo = AppUtil.convertParameters(request, gvo); //将request 中的参数设置到cvo
        new GoodsMgr().addTop(gvo);
        return mapping.findForward("doRecTopAdd");
    }

    public ActionForward toRecTopModify(ActionMapping mapping, ActionForm form,
                                        HttpServletRequest request,
                                        HttpServletResponse response) throws
            Exception {
        GenericVO tvo = new GoodsMgr().getTopDetail(BaseUtil.toInt(request.
                getParameter("top_id")));

        request.setAttribute("bean", tvo);
        return mapping.findForward("toRecTopModify");
    }

    public ActionForward doRecTopModify(ActionMapping mapping, ActionForm form,
                                        HttpServletRequest request,
                                        HttpServletResponse response) throws
            Exception {
        GenericVO gvo = new GenericVO();
        gvo = AppUtil.convertParameters(request, gvo); //将request 中的参数设置到cvo
        new GoodsMgr().modifyTop(gvo);

        this.genIndexTop();

        return mapping.findForward("doRecTopModify");
    }

    public ActionForward doRecTopDelete(ActionMapping mapping, ActionForm form,
                                        HttpServletRequest request,
                                        HttpServletResponse response) throws
            Exception {
        new GoodsMgr().deleteTop(BaseUtil.toInt(request.getParameter("top_id")));

        this.genIndexRecTop();

        return mapping.findForward("doRecTopDelete");
    }

    public ActionForward toRecTopEdit(ActionMapping mapping, ActionForm form,
                                      HttpServletRequest request,
                                      HttpServletResponse response) throws
            Exception {
        return mapping.findForward("toRecTopEdit");
    }

    public ActionForward doRecTopEdit(ActionMapping mapping, ActionForm form,
                                      HttpServletRequest request,
                                      HttpServletResponse response) throws
            Exception {
        String fileName = getServlet().getServletContext().getRealPath("/") +
                          "htmlet/rectop_" + request.getParameter("top_id") +
                          ".htm";
        String content =
                "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">" +
                request.getParameter("content");
        OutputStreamWriter osw = new OutputStreamWriter(new FileOutputStream(
                fileName), "UTF-8");
        osw.write(content, 0, content.length());
        osw.flush();
        osw.close();

        this.genIndexRecTop();

        return mapping.findForward("doRecTopEdit");
    }

    public ActionForward toRecTopEditor(ActionMapping mapping, ActionForm form,
                                        HttpServletRequest request,
                                        HttpServletResponse response) throws
            Exception {
        String fileName = getServlet().getServletContext().getRealPath("/") +
                          "htmlet/rectop_" + request.getParameter("top_id") +
                          ".htm";

        File f = new File(fileName);
        if (!f.exists()) {
            f.createNewFile();
        }
        //读取排行榜文�?
        BufferedReader br = new BufferedReader(new InputStreamReader(new
                FileInputStream(fileName), "UTF-8"));
        String data = null;
        String content = "";
        while ((data = br.readLine()) != null) {
            content = content + data;
        }
        br.close();

        request.setAttribute("CONTENT", content);
        return mapping.findForward("toRecTopEditor");
    }

    //推荐
    public ActionForward toGoodManage(ActionMapping mapping, ActionForm form,
                                      HttpServletRequest request,
                                      HttpServletResponse response) throws
            Exception {
        Vector r = new GoodsMgr().getTopGoodsType();

        request.setAttribute("RESULT", r);
        return mapping.findForward("toGoodManage");
    }

    public ActionForward toGoodDetail(ActionMapping mapping, ActionForm form,
                                      HttpServletRequest request,
                                      HttpServletResponse response) throws
            Exception {
        //根据item取得栏目的名�?
        String item = request.getParameter("item");
        String value = "";
        if (item.equalsIgnoreCase("index")) {
            value = "首页";
        } else {
            value = new GoodsMgr().getGoodsTypeDetail(BaseUtil.toInt(item)).
                    getItemStr("TYPENAME");
        }
        //得到精品商品
        Vector r = new GoodsMgr().getGoodByItem(item);

        request.setAttribute("VALUE", value);
        request.setAttribute("RESULT", r);
        return mapping.findForward("toGoodDetail");
    }

    public ActionForward toGoodAdd(ActionMapping mapping, ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response) throws
            Exception {
        //设置查询条件
        GenericVO gvo = new GenericVO();
        ListVO lvo = new ListVO();
        gvo = AppUtil.convertParameters(request, gvo); //将request 中的参数设置到cvo\uFFFD?
        lvo.setItemsPerPage(30);
        lvo = AppUtil.processListVO(lvo, request); //设置ListVO
        gvo.setListVO(lvo);

        //查询数据
        lvo = new GoodsMgr().searchGoods(gvo);

        gvo.setListVO(lvo);

        //设置页面数据
        request.setAttribute("bean", gvo);
        return mapping.findForward("toGoodAdd");
    }

    public ActionForward doGoodAdd(ActionMapping mapping, ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response) throws
            Exception {
        String[] goodIds = request.getParameterValues("good_id");
        GoodsMgr gm = new GoodsMgr();
        GenericVO gvo = new GenericVO();
        for (int i = 0; i < goodIds.length; i++) {
            gvo.add("ITEM", request.getParameter("item"));
            gvo.add("GOODS_ID", goodIds[i]);
            gm.AddGood(gvo);
        }

        if (request.getParameter("item").equalsIgnoreCase("index")) {
            genIndexGoodsList();
        }

        return mapping.findForward("doGoodAdd");
    }

    public ActionForward doGoodDelete(ActionMapping mapping, ActionForm form,
                                      HttpServletRequest request,
                                      HttpServletResponse response) throws
            Exception {
        new GoodsMgr().deleteGood(BaseUtil.toInt(request.getParameter("good_id")));

        if (request.getParameter("item").equalsIgnoreCase("index")) {
            genIndexGoodsList();
        }

        return mapping.findForward("doGoodDelete");
    }

    public ActionForward toPayMethodManage(ActionMapping mapping,
                                           ActionForm form,
                                           HttpServletRequest request,
                                           HttpServletResponse response) throws
            Exception {
        Vector r = new GoodsMgr().getPayMethod();

        request.setAttribute("RESULT", r);
        return mapping.findForward("toPayMethodManage");
    }

    public ActionForward toPayMethodAdd(ActionMapping mapping, ActionForm form,
                                        HttpServletRequest request,
                                        HttpServletResponse response) throws
            Exception {

        return mapping.findForward("toPayMethodAdd");
    }

    public ActionForward doPayMethodAdd(ActionMapping mapping, ActionForm form,
                                        HttpServletRequest request,
                                        HttpServletResponse response) throws
            Exception {
        GenericVO gvo = new GenericVO();
        gvo = AppUtil.convertParameters(request, gvo); //将request 中的参数设置到cvo
        new GoodsMgr().addPayMethod(gvo);

        return mapping.findForward("doPayMethodAdd");
    }

    public ActionForward toPayMethodModify(ActionMapping mapping,
                                           ActionForm form,
                                           HttpServletRequest request,
                                           HttpServletResponse response) throws

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -