您好,欢迎来到纷纭教育。
搜索
您的当前位置:首页基于javaweb+mysql的校园招聘平台系统(java+MySQL+Jdbc+Servlet+SpringMvc+Jsp)

基于javaweb+mysql的校园招聘平台系统(java+MySQL+Jdbc+Servlet+SpringMvc+Jsp)

来源:纷纭教育

一、项目简述

功能:
用户和企业用户的注册登录,简历的筛选查看搜索,应聘信息互动等等。
二、项目运行

环境配置:
Jdk1.8 + Tomcat8.5 + mysql + Eclispe(IntelliJ IDEA,Eclispe,MyEclispe,Sts都支持)

项目技术:
Jdbc+ Servlert + SpringMvc + Jsp + css + JavaScript + JQuery + Ajax + Fileupload等等

适用

课程设计,大作业,毕业设计,项目练习,学习演示等

                String filePath = path+fieldName;
                companyFile = fieldName;
                File file = new File(filePath);
                BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
                FileOutputStream fileOutputStream = new FileOutputStream(file);
                int line;
                while ((line = bufferedInputStream.read())!=-1){
                    fileOutputStream.write(line);
                }
                fileOutputStream.flush();
                fileOutputStream.close();
                bufferedInputStream.close();
            }
        }
        String[] split = sb.toString().split("&&");
        String companyName = split[0];
        String companyId = split[1];
        String password = split[2];
        String password2 = MyMD5Util.encrypt(password);
        BusinessVO businessVO = new BusinessVO(companyName, companyId, password2, companyFile);
        try {
            int i = BusinessDao.insertToVerify(businessVO);
            if (i == 1){
                jsonObject.put("code",2000);
                jsonObject.put("msg","waiting verify");//企业用户注册完,等待管理员审核
                System.out.println(path);
                String fieldName = companyName+"_"+companyId+"_"+item.getName();
                String filePath = path+fieldName;
                companyFile = fieldName;
                File file = new File(filePath);
                BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
                FileOutputStream fileOutputStream = new FileOutputStream(file);
                int line;
                while ((line = bufferedInputStream.read())!=-1){
                    fileOutputStream.write(line);
                }
                fileOutputStream.flush();
                fileOutputStream.close();
                bufferedInputStream.close();
            }
        }
        List<FileItem> items = upload.parseRequest(req);
        StringBuffer sb = new StringBuffer();
        String companyFile = null;
        for (FileItem item : items) {
            String name = item.getFieldName();
            InputStream inputStream = item.getInputStream();
            if (!name.equals("companyFile")){
                String string = item.getString();
                string = new String(string.getBytes("ISO8859_1"), StandardCharsets.UTF_8);
                sb.append(string+"&&");
            }else {
                String[] split = sb.toString().split("&&");
                String companyName = split[0];
                String companyId = split[1];
                String path=req.getServletContext().getRealPath("/");
                System.out.println(path);
                String fieldName = companyName+"_"+companyId+"_"+item.getName();
                String filePath = path+fieldName;
                companyFile = fieldName;
                File file = new File(filePath);
                BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
                FileOutputStream fileOutputStream = new FileOutputStream(file);
                int line;
                while ((line = bufferedInputStream.read())!=-1){
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String username = req.getParameter("username");
        String password = req.getParameter("password");
        password = MyMD5Util.encrypt(password);
        JSONObject jsonObject = new JSONObject();
        HttpSession session = req.getSession();
        Admin admin = new Admin(username, password);
        Admin adminFromDB = AdminDao.findByUsernamePassword(admin);
        if (adminFromDB!=null){
            jsonObject.put("code",2000);
            jsonObject.put("msg","login_success");
            jsonObject.put("admin",adminFromDB.getUsername());
            jsonObject.put("flag","success");
            resp.getWriter().print(jsonObject);
            session.setAttribute("admin",adminFromDB);
            return;
        }else {
            jsonObject.put("code",2000);
            jsonObject.put("msg","no admin");
            jsonObject.put("admin",null);
        resp.setCharacterEncoding("UTF-8");
        HttpSession session = req.getSession();
        if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) {
            jsonObject.put("code", 2000);
            jsonObject.put("flag", "fail");
            jsonObject.put("user", null);
            jsonObject.put("msg", "usernameOrPasswordIsBank");//用户名密码不能为空
            resp.getWriter().print(jsonObject);
            return;
        }
        password = MyMD5Util.encrypt(password);
        System.out.println(password);
        BusinessUserVO businessUserVO = new BusinessUserVO();
        businessUserVO.setUsername(username);
        businessUserVO.setPassword(password);
        StudentUserVO studentUserVO = new StudentUserVO();
        studentUserVO.setUsername(username);
        studentUserVO.setPassword(password);
        String flag1 = null;
        String flag2 = null;
        try {
            flag1 = BusinessUserDao.selectUsername(businessUserVO);
            if ("ok".equals(flag1)) {//企业用户名存在
                BusinessUserDTO businessUserDTO = BusinessUserDao.select(businessUserVO);
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        JSONObject jsonObject = new JSONObject();
        DiskFileItemFactory factory = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(factory);
        req.setCharacterEncoding("UTF-8");
        upload.setHeaderEncoding("UTF-8");
        List<FileItem> items = upload.parseRequest(req);
        StringBuffer sb = new StringBuffer();
        String companyFile = null;
        for (FileItem item : items) {
            String name = item.getFieldName();
            InputStream inputStream = item.getInputStream();
            if (!name.equals("companyFile")){
                String string = item.getString();
                string = new String(string.getBytes("ISO8859_1"), StandardCharsets.UTF_8);
                sb.append(string+"&&");
            }else {
                String[] split = sb.toString().split("&&");
                    jsonObject.put("code", 2000);
                    jsonObject.put("flag", "fail");//登录失败
                    jsonObject.put("user", null);
                    jsonObject.put("msg", "passwordError");//密码错误
                    resp.getWriter().print(jsonObject);
                    return;
                }
            }
            flag2 = StudentUserDao.selectUsername(studentUserVO);
            if ("ok".equals(flag2)) {//学生用户名存在
                StudentUser studentUser = StudentUserDao.select(studentUserVO);
                if (studentUser != null) {
                    jsonObject.put("code", 2000);
        String companyFile = null;
        for (FileItem item : items) {
            String name = item.getFieldName();
            InputStream inputStream = item.getInputStream();
            if (!name.equals("companyFile")){
                String string = item.getString();
                string = new String(string.getBytes("ISO8859_1"), StandardCharsets.UTF_8);
                sb.append(string+"&&");
            }else {
                String[] split = sb.toString().split("&&");
                String companyName = split[0];
                String companyId = split[1];
                String path=req.getServletContext().getRealPath("/");
                System.out.println(path);
                String fieldName = companyName+"_"+companyId+"_"+item.getName();
                String filePath = path+fieldName;
                companyFile = fieldName;
                File file = new File(filePath);
                BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
                FileOutputStream fileOutputStream = new FileOutputStream(file);
        String password = req.getParameter("password");
        resp.setCharacterEncoding("UTF-8");
        HttpSession session = req.getSession();
        if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) {
            jsonObject.put("code", 2000);
            jsonObject.put("flag", "fail");
            jsonObject.put("user", null);
            jsonObject.put("msg", "usernameOrPasswordIsBank");//用户名密码不能为空
            resp.getWriter().print(jsonObject);
            return;
        }
        password = MyMD5Util.encrypt(password);
        System.out.println(password);
        BusinessUserVO businessUserVO = new BusinessUserVO();
        businessUserVO.setUsername(username);
        businessUserVO.setPassword(password);
        StudentUserVO studentUserVO = new StudentUserVO();
        studentUserVO.setUsername(username);
        studentUserVO.setPassword(password);
        String flag1 = null;
        String flag2 = null;
        try {
            flag1 = BusinessUserDao.selectUsername(businessUserVO);
管理员登录控制层:
public class AdminLoginController extends HttpServlet {
    @SneakyThrows
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String username = req.getParameter("username");
        String password = req.getParameter("password");
        password = MyMD5Util.encrypt(password);
        JSONObject jsonObject = new JSONObject();
        HttpSession session = req.getSession();
        Admin admin = new Admin(username, password);
        Admin adminFromDB = AdminDao.findByUsernamePassword(admin);
        if (adminFromDB!=null){
            jsonObject.put("code",2000);
            jsonObject.put("msg","login_success");
            jsonObject.put("admin",adminFromDB.getUsername());
            jsonObject.put("flag","success");
            resp.getWriter().print(jsonObject);
            session.setAttribute("admin",adminFromDB);
            return;
        }else {
            jsonObject.put("code",2000);

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- fenyunshixun.cn 版权所有 湘ICP备2023022495号-9

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务