欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

java开发就业信息管理系统

程序员文章站 2024-03-12 17:39:08
本文实例为大家分享了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 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 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" style="text-align:center;"><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标签的网页跳转的功能
}

效果图:

java开发就业信息管理系统

java开发就业信息管理系统

java开发就业信息管理系统

更多学习资料请关注专题《管理系统开发》。

以上就是本文的全部内容,希望对大家的学习有所帮助。