The examples in this article share with you the Java employment information management platform development case for your reference. The specific content is as follows
You can query company information, student information, class information, statistics on student employment information, and statistics on whether students are employed or not. Teachers and administrators have different permissions after logging in. What you want to achieve is the employment status of students in each class. There are 6 tables in the database, namely class, company, position, student, and logged-in users .
The content displayed on the interface of the employment information is a combination of student information and position, which is spliced in the jsp page. If the student finds a job, he needs to fill in the employment information, otherwise it will be empty. As for employment screenshot.
In corporate information, the function that needs to be implemented is to first have a planned recruitment time. The actual recruitment time is always available. If the recruitment of this company is over, the actual recruitment time and actual recruitment teacher must be filled in through the subsequent editor, and the recruitment status is displayed as ended; otherwise, the recruitment status is in the recruitment status. There are two other functions, which are two types of queries: one is to use the option drop-down box based on the recruitment query; instead, query based on the company name, enter the company keyword in the box, and like fuzzy query is used here. In the employment information, only the query based on the class name in the option drop-down selection is used.
Only accurate query of input keywords is used in class information. The statistics they query will be paged according to the number of pieces that can be displayed on each page, especially the drop-down box to select the query, and they may have more than one piece of information.
The basic information contains class information and student information , and the student information displays the basic information of students.
One feature of the modified password and user information displayed in personal information is the permissions of administrators and ordinary teachers. Ordinary teachers can only view information when logging in, but they cannot make any modifications.
All basic information can be added, deleted, modified and checked. There are still difficulties encountered when doing paging query - drop-down selection. In addition, it is the page.js file used when paging, which page is displayed/how many pages in total, home page/previous page/next page/last page/last page.
There is also the permission issue. When I register a logged in user in the database, I have a permission permission, fill in yes/no, and then make a judgment in the subsequent program. The only drawback of this project is that it does not realize the import and export function, which is to set an import and export button in the upper right corner of the employment information bar, which is a template. The import implements batch input of student information in Excel, and the export implements the export of students' employment situations out of the Excel table form.
1. addCompany_action.java
package com.ben.emp.action; import java.io.IOException;import java.text.ParseException;import java.text.SimpleDateFormat; import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import javax.servlet.http.HttpSession; import com.ben.emp.model.company;import com.ben.emp.model.user;import com.ben.emp.service.companyService;import com.ben.emp.service.impl.companyServiceImpl; @WebServlet("/addCompany.action")public class addCompany_action extends HttpServlet{ @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.getRequestDispatcher("/addCompany.jsp").forward(req, resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String name = req.getParameter("name"); String introduction = req.getParameter("introduce"); String requirement = req.getParameter("requirement"); String address = req.getParameter("address"); String plantime = req.getParameter("plantime"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); companyService cs = new companyServiceImpl(); company com = new company(); HttpSession session = req.getSession(true); user user = (user) session.getAttribute("user"); com.setName(name); com.setIntroduce(introduce); com.setRequirement(requirment); com.setAddress(address); try { com.setPlantime(sdf.parse(plantime)); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } com.setState("Recruitment"); com.setTeach1(user.getName()); com.setTeach2(""); com.setId(0); cs.addCompany(com); resp.sendRedirect(req.getContextPath()+"/company.action"); }}2. editStudent_action.java
package com.ben.emp.action; import java.io.IOException;import java.text.ParseException;import java.text.SimpleDateFormat; import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import com.ben.emp.model.classes;import com.ben.emp.model.student;import com.ben.emp.service.classesService;import com.ben.emp.service.studentService;import com.ben.emp.service.impl.classesServiceImpl;import com.ben.emp.service.impl.studentServiceImpl; @WebServlet("/editStudent.action")public class editStudent_action extends HttpServlet{ @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String strid = req.getParameter("id"); int studentId = Integer.valueOf(strid); studentService ss = new studentServiceImpl(); student ss = ss.getStudentById(stu"); req.setAttribute("stu", stu); req.getRequestDispatcher("/editStudent.jsp").forward(req, resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String strid = req.getParameter("id"); int studentId = Integer.valueOf(strid); String name = req.getParameter("studentname"); String sex = req.getParameter("sex"); String school = req.getParameter("school"); String major = req.getParameter("major"); String bytime = req.getParameter("bytime"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); String tel = req.getParameter("telephone"); String qq = req.getParameter("qq"); studentService ss = new studentServiceImpl(); student ss = new student();// HttpSession session = req.getSession(true); // user user = (user)session.getAttribute("user"); String classname = req.getParameter("selectclass"); classesService cs = new classesServiceImpl(); classes cla = cs.getClassesByName(classname); stu.setName(name); stu.setSex(sex); stu.setSchool(school); stu.setMajor(major); try { stu.setBytime(sdf.parse(bytime)); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } stu.setTel(tel); stu.setQq(qq); stu.setClassid(cla.getId()); stu.setId(stu); ss.editStudent(stu); resp.sendRedirect(req.getContextPath()+"/student.action"); } }3. employee_action.java
package com.ben.emp.action; import java.io.IOException;import java.util.ArrayList;import java.util.List;import javax.servlet.ServletException;import javax.servlet.annotation.WebServlet;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;import com.ben.emp.model.classes;import com.ben.emp.model.info;import com.ben.emp.model.student;import com.ben.emp.service.classesService;import com.ben.emp.service.infoService;import com.ben.emp.service.studentService;import com.ben.emp.service.impl.classesServiceImpl;import com.ben.emp.service.impl.studentServiceImpl;import com.ben.emp.service.impl.studentServiceImpl;import com.ben.emp.service.impl.studentServiceImpl; @WebServlet("/employ.action")public class employee_action extends HttpServlet{ @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { classesService cs = new classesServiceImpl(); List<classes> cla = cs.getClasses(); List<String> lst = new ArrayList<String>(); for(classes ele : cla){ String name = ele.getName(); lst.add(name); } studentService ss = new studentServiceImpl(); List<student> lstu = ss.getStudentPage(1, 10); infoService is = new infoServiceImpl(); //Connect to the employment information table List<info> lin = new ArrayList<info>(); for(student ele : lstu){ info info = new info(); info = is.getInfoByStudentId(ele.getId()); lin.add(info); } List<student> count = ss.getStudentPage(1, Integer.MAX_VALUE); int number = count.size(); int page = number % 10 == 0 ? number / 10 : (number/10) + 1; req.setAttribute("lst", lst); req.setAttribute("value", "all"); req.setAttribute("number", number); req.setAttribute("page", page); req.setAttribute("index", 1); req.setAttribute("list", lstu); req.setAttribute("lin", lin); req.getRequestDispatcher("/employ.jsp").forward(req, resp); } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String value = req.getParameter("select"); classesService cs = new classesServiceImpl(); List<classes> cla = cs.getClasses(); List<String> lst = new ArrayList<String>(); lst.add("all"); for(classes ele : cla){ String name = ele.getName(); lst.add(name); } lst.remove(value); studentService ss = new studentServiceImpl(); infoService is = new infoServiceImpl(); //Connect to the employment information table List<info> lin = new ArrayList<info>(); if(value.equals("all")){ List<student> count = ss.getStudentPage(1, Integer.MAX_VALUE); int number = count.size(); int page = number % 10 == 0 ? number / 10 : (number/10) + 1; String strpageIndex = req.getParameter("pageIndex"); int index = Integer.valueOf(strpageIndex); List<student> lstu = ss.getStudentPage(index, 10); for(student ele : lstu){ info info = new info(); info = is.getInfoByStudentId(ele.getId()); lin.add(info); } req.setAttribute("number", number); req.setAttribute("page", page); req.setAttribute("index", index); req.setAttribute("list", lstu); req.setAttribute("lin", lin); }else{ List<student> count = ss.getStudentByClassName(value, 1, Integer.MAX_VALUE); int number = count.size(); int page = number % 10 == 0 ? number / 10 : (number/10) + 1; String strpageIndex = req.getParameter("pageIndex"); int index = Integer.valueOf(strpageIndex); List<student> lstu = ss.getStudentByClassName(value, index, 10); for(student ele : lstu){ info info = new info(); info = is.getInfoByStudentId(ele.getId()); lin.add(info); } req.setAttribute("number", number); req.setAttribute("page", page); req.setAttribute("index", index); req.setAttribute("list", lstu); req.setAttribute("lin", lin); } req.setAttribute("value", value); req.setAttribute("lst", lst); req.getRequestDispatcher("/employ.jsp").forward(req, resp); }}4. employee.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%><%@ include file="base.jsp" %><%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>Unt titled document</title><link href="css/style.css" rel="stylesheet" type="text/css" /><script type="text/javascript" src="js/jquery.js"></script><!-- A line of jquery.js --><script type="text/javascript" src="js/jquery-1.11.0.min.js"></script><script type="text/javascript" src="js/page.js"></script><script type="text/javascript">$(function(){ $("select").change(function(){ $("#pageIndex").val(1); $("form").submit(); }); $(".pg").click(subfun);}); function subfun(){ var id = $(this).attr("id"); var value = $("#pageIndex").val(); var count = $("#pageCount").val(); if(id == "first"){ $("#pageIndex").val(1); $("form").submit(); }else if(id == "previous"){ if(Number(value) == 1){ return false; }else{ $("#pageIndex").val(Number(value)-1); $("form").submit(); } }else if(id == "next"){ if(value == count){ return false; }else{ $("#pageIndex").val(Number(value)+1); $("form").submit(); } }else{ $("#pageIndex").val(count); $("form").submit(); } return false;//Function to prevent web pages from jumping with a tag}</script></head><body> <div> <span>Location:</span> <ul> <li><a href="#">Home</a></li> <li><a href="#">Employ information</a></li> </div> <form action="employ.action" method="post"> <div> <div> <ul> <li><span>Class name: <select style="border:1px solid #056dae" id="select" name="select"> <option>${requestScope.value }</option> <c:forEach items="${requestScope.lst }" var="ele"> <option>${ele }</option> </c:forEach> </select> </span></li> </ul> <ul> <li><span><img src="images/t05.png" /></span> Download</li> </ul> </div> <table> <thead> <tr> <th>Name</th> <th>Gender</th> <th>Graduate School</th> <th>Major</th> <th>Graduation Time</th> <th>Tel</th> <th>Employment Unit</th> <th>Position</th> <th>Salary</th> <th>Employment Time</th> </tr> </thead> <tbody> <c:forEach items="${requestScope.list }" var="stu" varStatus="s"> <tr> <td>${stu.name }</td> <td>${stu.sex }</td> <td>${stu.school }</td> <td>${stu.major }</td> <td>${stu.bytime }</td> <td>${stu.tel }</td> <c:if test="${requestScope.lin[s.index] == null }" > <td colspan="4" style="text-align:center;"><a href="addInfo.action?id=${stu.id }">Fill in employment information</a></td> </c:if> <c:if test="${requestScope.lin[s.index] != null }"> <td>${requestScope.lin[s.index].companyname }</td> <td>${requestScope.lin[s.index].post }</td> <td>${requestScope.lin[s.index].salary }</td> <td>${requestScope.lin[s.index].worktime }</td> </c:if> </tr> </c:forEach> </tbody> </table> <input type="hidden" name="pageIndex" id="pageIndex" value="${requestScope.index }"> <input type="hidden" name="pageCount" id="pageCount" value="${requestScope.page }"> <input type="hidden" name="pageNumber" id="pageNumber" value="${requestScope.number }"> <div id="page"> <div>Total <i>${requestScope.number }</i> records, total <i>${requestScope.page }</i> page, currently displaying <i>${requestScope.index }</i> page</div> <ul> <li><a href="javascript:;" id="first"><span></span></a></li> <li><a href="javascript:;" id="previous">Previous page</a></li> <li><a href="javascript:;" id="next">Next page</a></li> <li><a href="javascript:;" id="last"><span></span></a></li> </ul> </div> </div> </form></body></html>5. page.js
$(function(){ $(".paginItem").click(subfun);});function subfun(){ //You must know which class I am getting and which a tag I am clicking var id = $(this).attr("id"); var value = $("#pageIndex").val(); //Get the current page var count = $("#pageCount").val(); //Get the last page if(id == "first"){ $("#pageIndex").val(1); //Get the current page $("form").submit(); //Submit the form through the a tag}else if(id == "previous"){ //Judge whether this page is the home page. If it is the home page, judge whether the current page is 1 ==1Homepage!=1 is not the homepage if(Number(value) == 1){ return false; }else{ $("#pageIndex").val(Number(value)-1); $("form").submit(); } }else if(id == "next"){ //Judge whether the current page is the last page and the last page How to judge whether the calculation last page calculates the total number of calculating database/ How to calculate how many results are displayed per page +1 if(value == count){ return false; }else{ $("#pageIndex").val(Number(value)+1); $("form").submit(); } }else{ $("#pageIndex").val(count); $("form").submit(); } return false; //Function to prevent web pages from jumping with a tag}Reproduction image:
For more learning materials, please pay attention to the special topic "Management System Development".
The above is all about this article, I hope it will be helpful to everyone's learning.