程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> JAVA編程 >> 關於JAVA >> java開辟失業信息治理體系

java開辟失業信息治理體系

編輯:關於JAVA

java開辟失業信息治理體系。本站提示廣大學習愛好者:(java開辟失業信息治理體系)文章只能為提供參考,不一定能成為您想要的結果。以下是java開辟失業信息治理體系正文


本文實例為年夜家分享了java失業信息治理平台開辟案例,供年夜家參考,詳細內容以下

可查詢公司信息,先生信息,班級信息,針對先生失業與否信息的統計,先生和治理員登錄後的權限分歧等
失業信息治理平台想要完成的是各個班級的先生失業情形,數據庫裡建有6張表,分離是班級,公司,職位,先生,登錄用戶。

個中失業信息在界面上顯示的內容是先生信息和職位的組合,在jsp頁面中是拼接來完成,假如這個先生找到任務則須要填寫失業信息,不然空著。如失業截圖。

在企業信息中,須要完成的功效是起首有籌劃雇用時光,現實雇用時光,每一個都有先生,假如這個公司雇用停止,則要經由過程前面的編纂把現實雇用時光和現實雇用先生填寫上去,雇用狀況顯示為已停止;不然不填,雇用狀況為雇用中。還有兩個功效就是兩種查詢:一是依據雇用查詢,采取option下拉框中的選擇;而是依據公司稱號查詢,是在框中輸出公司症結字查詢,這裡用到了like隱約查詢。而在失業信息中只用到了option下拉選擇中的依據班級名的查詢。

在班級信息只用到了輸出症結字的准確查詢。他們查詢到的統計信息都邑依據每頁可以或許顯示的條數停止分頁,特別是下拉框選擇查詢,它們能夠不只一條信息。

基本信息裡有班級信息和先生信息,先生信息顯示的是先生的根本信息。

小我信息裡顯示的修正暗碼和用戶信息,用戶信息的一個特色是治理員和通俗教員的權限成績。通俗教員登錄只能檢查信息,但不克不及作任何修正。

一切根本信息都能完成增刪改查,個中作分頁查詢時碰到的難點照樣有的——下拉選擇,另外就是分頁時用到的page.js文件,完成的是顯示第幾頁/共幾頁,首頁/上一頁/下一頁/尾頁。

還有就是權限成績,我是在數據庫中注冊登錄用戶時都有一個permission權限,填yes/no,然後在前面的法式中斷定出來。本項目獨一缺憾就是沒有完成導入導出功效,就是在失業信息欄右上角設置一個導入和導出按鈕,就是一個模板,導入完成的是批量輸出excel中的先生信息,導出完成的是把先生的失業情形導出excel表格情勢。

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 introduce = 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(requirement);
 com.setAddress(address);
 try {
 com.setPlantime(sdf.parse(plantime));
 } catch (ParseException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
 }
 com.setState("雇用中");
 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.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 stu = ss.getStudentById(studentId);
 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 stu = 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(studentId);
 ss.editStudent(stu);
 resp.sendRedirect(req.getContextPath()+"/student.action");
 }
 
}

3. employ_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.infoServiceImpl;
import com.ben.emp.service.impl.studentServiceImpl;
 
@WebServlet("/employ.action")
public class employ_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(); //銜接到失業信息內外
 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", "全體");
 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("全體");
 for(classes ele : cla){
 String name = ele.getName();
 lst.add(name);
 }
 lst.remove(value); 
 studentService ss = new studentServiceImpl();
 infoService is = new infoServiceImpl(); //銜接到失業信息內外
 List<info> lin = new ArrayList<info>(); 
 if(value.equals("全體")){
 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. employ.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>無題目文檔</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery.js"></script>
<!-- 本身加的一行 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;//阻攔a標簽的網頁跳轉的功效
}
</script>
</head>
<body>
 <div class="place">
 <span>地位:</span>
 <ul class="placeul">
 <li><a href="#">首頁</a></li>
 <li><a href="#">失業信息</a></li>
 </ul>
 </div>
 <form action="employ.action" method="post">
 <div class="rightinfo"> 
 <div class="tools">
 <ul class="toolbar">
 <li><span>班級稱號: 
 <select  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 class="toolbar1">
 <li><span><img src="images/t05.png" /></span>下載</li>
 </ul>
 </div>
 <table class="imgtable">
 <thead>
 <tr>
 <th width="100px;">姓名</th>
 <th>性別</th>
 <th>卒業院校</th>
 <th>專業</th>
 <th>卒業時光</th>
 <th>德律風</th>
 <th>失業單元</th>
 <th>職位</th>
 <th>工資</th>
 <th>失業時光</th>
 </tr>
 </thead>
 <tbody>
 <c:forEach items="${requestScope.list }" var="stu" varStatus="s">
 <tr>
 <td class="imgtd">${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" ><a href="addInfo.action?id=${stu.id }">填寫失業信息</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 class="pagin" id="page">
 <div class="message">共<i class="blue"> ${requestScope.number } </i>筆記錄,共<i class="blue">
  ${requestScope.page }</i> 頁,以後顯示第 <i class="blue">${requestScope.index } </i>頁</div>
 <ul class="paginList">
 <li class="paginItem"><a href="javascript:;" class="paginItem" id="first"><span class="pagepre"></span></a></li>
 <li class="paginItem"><a href="javascript:;" class="paginItem" id="previous">上一頁</a></li>
 <li class="paginItem"><a href="javascript:;" class="paginItem" id="next">下一頁</a></li>
 <li class="paginItem"><a href="javascript:;" class="paginItem" id="last"><span class="pagenxt"></span></a></li>
 </ul>
 </div>
 </div>
 </form>
</body>
</html>

5. page.js   

$(function(){
 $(".paginItem").click(subfun);
});
function subfun(){  //必需要曉得我獲得的是哪個class,我點的是哪個a標簽
 var id = $(this).attr("id");
 var value = $("#pageIndex").val(); //獲得以後頁
 var count = $("#pageCount").val(); //獲得尾頁
 if(id == "first"){
 $("#pageIndex").val(1); //將pageIndex以後頁
 $("form").submit(); //經由過程a標簽停止表單提交
 }else if(id == "previous"){ //斷定 本頁能否為首頁 假如為首頁 假如部位首頁的話 斷定以後頁能否為1 ==1首頁 !=1 不是首頁
 if(Number(value) == 1){
 return false;
 }else{
 $("#pageIndex").val(Number(value)-1);
 $("form").submit();
 }
 }else if(id == "next"){ //斷定以後頁能否為尾頁 尾頁若何斷定 盤算尾頁 盤算數據庫的總條數 / 每頁顯示若干條 成果能否+1
 if(value == count){
 return false;
 }else{
 $("#pageIndex").val(Number(value)+1);
 $("form").submit();
 }
 }else{
 $("#pageIndex").val(count);
 $("form").submit();
 }
 return false;  //阻攔a標簽的網頁跳轉的功效
}

後果圖:

以上就是本文的全體內容,願望對年夜家的進修有所贊助。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved