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

📄 servlet2.java

📁 JAVA 开发的一个企业网站 JAVABEAN+JSP +ACCE
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        try {
            String condition = "update customerMessage set hf='" + hf +
                               "' where id=" + id;
            System.out.print(condition);
            jdbc.execUpdate(condition);

            out.println("<script languaga=\"JavaScript\">alert(\"回复成功!\");window.location = \"basic/admin/customerMessage.jsp\";</script>");

        } catch (Exception ex) {
            ex.printStackTrace();
            out.print("<script>alert('    回复失败!')</script>");
            out.print("<script>history.back(-1)</script>"); //返回原来页面

        }
        //response.sendRedirect("");

    }


    //顾客留言

    public void customerMessage(HttpServletRequest request,
                                HttpServletResponse response) throws
            ServletException, IOException {
        String name = toString(request.getParameter("name"));
        String email = toString(request.getParameter("email"));
         String nr = toString(request.getParameter("nr"));
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        try {
            String condition =
                    " INSERT INTO customerMessage (name,email,nr) VALUES " +
                    "(" + "'" + name +
                    "','" + email + "','" +
                    nr + "')";
            System.out.print(condition);
            jdbc.execUpdate(condition);

            out.println("<script languaga=\"JavaScript\">alert(\"信息已发送,谢谢关临!\");window.location = \"basic/liuyan.jsp\";</script>");

        } catch (Exception ex) {
            ex.printStackTrace();

            out.print("<script>alert('    信息不能为空!')</script>");
            out.print("<script>history.back(-1)</script>"); //返回原来页面

        }

    }

    //人才策略
    public void RCZhaoping(HttpServletRequest request,
                           HttpServletResponse response) throws
            ServletException, IOException {
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        String ZP_lb = toString(request.getParameter("lb"));
        String ZP_nr = new String(request.getParameter("content1").getBytes(
                "iso8859_1"));
        if (ZP_nr.equals("<P align=left>&nbsp;</P>")) {
            out.print("<script>alert('    内容不能为空!')</script>");
            out.print("<script>history.back(-1)</script>"); //返回原来页面
        } else {
            try {
                String condition = "update RCzhaoping set ZP_nr='" + ZP_nr +
                                   "' where ZP_lb='" + ZP_lb + "'";
                System.out.print(condition);
                jdbc.execUpdate(condition);

                out.println("<script languaga=\"JavaScript\">alert(\"    发送成功!\");window.location = \"basic/admin/RCzhaoping.jsp\";</script>");

            } catch (Exception ex) {

                out.print("<script>alert('    发送失败!')</script>");
                out.print("<script>history.back(-1)</script>"); //返回原来页面

            }
        }
    }

    //发布公司招聘
    public void customerZhaoping(HttpServletRequest request,
                                 HttpServletResponse response) throws
            ServletException, IOException {
        String zptime = toString(request.getParameter("zpdw"));
        String bm = toString(request.getParameter("bm"));
        String gw = toString(request.getParameter("gw"));
        String email = toString(request.getParameter("email"));
        String yptj = toString(request.getParameter("yptj"));
        String sj = toString(request.getParameter("time"));
        String rs = toString(request.getParameter("rs"));
        String rzyq = toString(request.getParameter("rzyq"));
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        try {
            String condition =
                    "INSERT INTO customerZhaoping(zptime,bm,gw,email,yptj,rs,rzyq,sj) VALUES" +
                    "(" + "'" + zptime + "','" + bm + "','" + gw +
                    "','" + email + "','" + yptj + "'," + rs + ",'" + rzyq +
                    "','"
                    + sj + "')";
            System.out.print(condition);
            jdbc.execUpdate(condition);

            out.println("<script languaga=\"JavaScript\">alert(\"    发送成功!\");window.location = \"basic/admin/zhaoping.jsp\";</script>");

        } catch (Exception ex) {

            out.print("<script>alert('    发送失败!')</script>");
            out.print("<script>history.back(-1)</script>"); //返回原来页面

        }
    }

    //删除招聘信息
    public void delzhaoping(HttpServletRequest request,
                            HttpServletResponse response) throws
            ServletException, IOException {
        String[] sc = request.getParameterValues("sc");
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        try {
            if (sc != null) {
                for (int i = 0; i < sc.length; i++) {
                    String condition = "delete from customerZhaoping where id=" +
                                       sc[i];
                    System.out.print(condition);
                    jdbc.execUpdate(condition);
                }

                out.println("<script languaga=\"JavaScript\">alert(\"    删除成功!\");window.location = \"basic/admin/gl zhaoping.jsp\";</script>");

            }

        } catch (Exception ex) {
            ex.printStackTrace();
        }

        out.print("<script>alert('    删除失败!')</script>");
        out.print("<script>history.back(-1)</script>"); //返回原来页面
    }

//更改网站公告
    public void wzgg(HttpServletRequest request, HttpServletResponse response) throws
            ServletException, IOException, SQLException {
        String bt = toString(request.getParameter("bt"));
        String wzgg = toString(request.getParameter("wzgg"));
        String id = toString(request.getParameter("id1"));
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        try {
            String condition = "update wzgg set bt='" + bt + "', wzgg='" + wzgg +
                               "'" +

                               " where id=" + id;

            System.out.print(condition);
            jdbc.execUpdate(condition);

            out.println("<script languaga=\"JavaScript\">alert(\"    更改成功!\");window.location = \"basic/admin/wzgg.jsp\";</script>");

        } catch (Exception ex) {
            ex.printStackTrace();

            out.print("<script>alert('    输入不能为空!')</script>");
            out.print("<script>history.back(-1)</script>"); //返回原来页面

        }
    }

    //添加网站公告
    public void addwzgg(HttpServletRequest request,
                        HttpServletResponse response) throws
            ServletException, IOException, SQLException {
        String bt = toString(request.getParameter("bt"));
        String wzgg = toString(request.getParameter("wzgg"));
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        try {
            String condition =
                    " INSERT INTO wzgg (bt,wzgg) VALUES " +
                    "(" + "'" + bt + "','" +
                    wzgg + "')";
            System.out.print(condition);
            jdbc.execUpdate(condition);

            out.println("<script languaga=\"JavaScript\">alert(\"    添加成功!\");window.location = \"basic/admin/wzgg.jsp\";</script>");

        } catch (Exception ex) {
            ex.printStackTrace();

            out.print("<script>alert('    输入不能为空!')</script>");
            out.print("<script>history.back(-1)</script>"); //返回原来页面

        }
    }

//删除公告

    public void delwzgg(HttpServletRequest request,
                        HttpServletResponse response) throws
            ServletException, IOException {
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        String[] sc = request.getParameterValues("sc");
        try {
            if (sc != null) {
                for (int i = 0; i < sc.length; i++) {
                    String condition = "delete from wzgg where id=" +
                                       sc[i];
                    System.out.print(condition);
                    jdbc.execUpdate(condition);
                }

                out.println("<script languaga=\"JavaScript\">alert(\"删除成功!\");window.location = \"basic/admin/wzgg.jsp\";</script>");

            }

        } catch (Exception ex) {
            ex.printStackTrace();
        }

        out.print("<script>alert('    请选择删除内容!!')</script>");
        out.print("<script>history.back(-1)</script>"); //返回原来页面

    }

//总裁致辞
    public void zczc(HttpServletRequest request, HttpServletResponse response) throws
            ServletException, IOException, SQLException {
        String zczc = new String(request.getParameter("content1").getBytes(
                "iso8859_1"));
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        try {
            String condition = "update lxfs set zczc='" + zczc + "'";

            System.out.print(condition);
            jdbc.execUpdate(condition);

            out.println("<script languaga=\"JavaScript\">alert(\"    更改成功!\");window.location = \"basic/admin/zczc.jsp\";</script>");

        } catch (Exception ex) {
            ex.printStackTrace();

            out.print("<script>alert('    输入不能为空!')</script>");
            out.print("<script>history.back(-1)</script>"); //返回原来页面

        }
    }

    //公司宗旨
    public void gszz(HttpServletRequest request, HttpServletResponse response) throws
            ServletException, IOException, SQLException {
        String gszz = new String(request.getParameter("content1").getBytes(
                "iso8859_1"));
        response.setContentType(CONTENT_TYPE);
        PrintWriter out = response.getWriter();
        try {
            String condition = "update lxfs set gszz='" + gszz + "'";

            System.out.print(condition);
            jdbc.execUpdate(condition);

            out.println("<script languaga=\"JavaScript\">alert(\"    更改成功!\");window.location = \"basic/admin/gszz.jsp\";</script>");

        } catch (Exception ex) {
            ex.printStackTrace();

            out.print("<script>alert('    输入不能为空!')</script>");
            out.print("<script>history.back(-1)</script>"); //返回原来页面

        }
    }



    //Clean up resources
    public void destroy() {
    }
}

⌨️ 快捷键说明

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