基于javaweb+mysql的jsp+servlet大学生求职招聘管理系统(java+jsp+javascript+ajax+mysql)
运行环境
Java≥8、MySQL≥5.7、Tomcat≥8
开发工具
eclipse/idea/myeclipse/sts等均可配置运行
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
功能说明
基于javaweb+mysql的JSP+Servlet大学生求职招聘管理系统(java+jsp+javascript+ajax+mysql)
项目介绍
本项目分为管理员、求职者、企业用户三种角色, 管理员角色包含以下功能: 招聘信息管理,求职信息管理,工作地点管理,求职技巧管理,职场咨询管理,系统简介管理,友情链接管理,关于我们管理,留言板管理和回复,求职者管理,企业信息管理,管理员信息管理,修改个人信息和密码等功能。
求职者角色包含以下功能: 求职者首页,求职者登录注册,招聘信息查看,企业资料查看,企业推荐查看,查看求职技巧,系统简介,留言板查看,个人简历管理,个人基本信息管理,我的工作申请,企业和工作推荐查看,企业来信查看,查看收藏的职位等功能。
企业用户角色包含以下功能: 企业登录注册,招聘信息管理,求职信息管理,人才推荐管理,企业详情管理等功能。
环境需要
1.运行环境:最好是java jdk 1.8,我们在这个平台上运行的。其他版本理论上也可以。 2.IDE环境:IDEA,Eclipse,Myeclipse都可以。推荐IDEA; 3.tomcat环境:Tomcat 7.x,8.x,9.x版本均可 4.硬件环境:windows 7/8/10 1G内存以上;或者 Mac OS; 5.数据库:MySql 5.7版本; 6.是否Maven项目:否;
技术栈
- 后端:Servlet 2. 前端:JSP+JavaScript+JQuery+CSS+Ajax
使用说明
- 使用Navicat或者其它工具,在mysql中创建对应名称的数据库,并导入项目的sql文件; 2. 使用IDEA/Eclipse/MyEclipse导入项目,Eclipse/MyEclipse导入时,若为maven项目请选择maven;若为maven项目,导入成功后请执行maven clean;maven install命令,然后运行; 3. 将项目中dbconnection.properties配置文件中的数据库配置改为自己的配置; 4. 运行项目,输入localhost:8080/jsp_qzzp_sys/ 登录 注:Tomcat中配置的路径必须为/jsp_qzzp_sys 管理员账号/密码:admin/admin 求职者账号/密码:qiuzhi/123456 企业账号/密码:qiye/123456
filename = Info.generalFileName(fullFile.getName());
File newFile = new File(request.getRealPath("/upfile/")+"/" + filename);
try {
fileItem.write(newFile);
} catch (Exception e) {
e.printStackTrace();
}
}else{
}
}
}
go("/js/uploadimg5.jsp?filename="+filename, request, response);
} catch (Exception e1) {
e1.printStackTrace();
}
}
//
if(ac.equals("addxspl")){
String savetime = Info.getDateStr();
String utype = "求职者";
try {
String filename="";
request.setCharacterEncoding("utf-8");
RequestContext requestContext = new ServletRequestContext(request);
if(FileUpload.isMultipartContent(requestContext)){
DiskFileItemFactory factory = new DiskFileItemFactory();
factory.setRepository(new File(request.getRealPath("/upfile/")+"/"));
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setSizeMax(100*1024*1024);
List items = new ArrayList();
items = upload.parseRequest(request);
FileItem fileItem = (FileItem) items.get(0);
if(fileItem.getName()!=null && fileItem.getSize()!=0){
File fullFile = new File(fileItem.getName());
filename = Info.generalFileName(fullFile.getName());
File newFile = new File(request.getRealPath("/upfile/")+"/" + filename);
try {
fileItem.write(newFile);
} catch (Exception e) {
e.printStackTrace();
}
}else{
}
}
List result = new ArrayList();
File uploadFileName = new File(request.getRealPath("/upfile/")+"/" + filename);
public class Info {
public static HashMap getUser(HttpServletRequest request)
{
HashMap map = (HashMap)(request.getSession().getAttribute("admin")==null?request.getSession().getAttribute("user"):request.getSession().getAttribute("admin"));
return map;
}
public static int getBetweenDayNumber(String dateA, String dateB) {
long dayNumber = 0;
//1小时=60分钟=3600秒=3600000
long mins = 60L * 1000L;
//long day= 24L * 60L * 60L * 1000L;计算天数之差
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
java.util.Date d1 = df.parse(dateA);
java.util.Date d2 = df.parse(dateB);
dayNumber = (d2.getTime() - d1.getTime()) / mins;
return imgStr.toString();
}
private static Properties config = null;
static {
try {
config = new Properties();
// InputStream in = config.getClass().getResourceAsStream("dbconnection.properties");
InputStream in = CommDAO.class.getClassLoader().getResourceAsStream("dbconnection.properties");
config.load(in);
System.out.println(config.get("dburl"));
in.close();
} catch (Exception e) {
e.printStackTrace();
}
}
public HashMap getmap(String id,String table)
{
List<HashMap> list = new ArrayList();
try {
Statement st = conn.createStatement();
System.out.println("select * from "+table+" where id="+id);
ResultSet rs = st.executeQuery("select * from "+table+" where id="+id);
ResultSetMetaData rsmd = rs.getMetaData();
while(rs.next())
{
HashMap map = new HashMap();
int i = rsmd.getColumnCount();
for(int j=1;j<=i;j++)
{
if(!rsmd.getColumnName(j).equals("ID"))
{
String str = rs.getString(j)==null?"": rs.getString(j);
if(str.equals("null"))str = "";
map.put(rsmd.getColumnName(j), str);
public class MainCtrl extends HttpServlet {
public MainCtrl() {
super();
}
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doPost(request, response);
}
public void go(String url,HttpServletRequest request, HttpServletResponse response)
{
try {
request.getRequestDispatcher(url).forward(request, response);
} catch (ServletException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public void gor(String url,HttpServletRequest request, HttpServletResponse response)
{
try {
response.sendRedirect(url);
} catch (IOException e) {
}else{
}
}
if(filename.indexOf(".xls")>-1)
{
Workbook workbook;
try {
workbook = Workbook.getWorkbook(new File(request.getRealPath("/upfile/")+"/"+filename));
//通过Workbook的getSheet方法选择第一个工作簿(从0开始)
Sheet sheet = workbook.getSheet(0);
//通过Sheet方法的getCell方法选择位置为C2的单元格(两个参数都从0开始)
//int empty = 0;
for(int i=1;i<1000;i++)
{
Cell cell = null;
try{
String isql = "insert into "+tablename+"(";
for(String str:whzdstr.split("-"))
{
isql+=str+",";
}
isql = isql.substring(0,isql.length()-1);
isql+=")values(";
int j=0;
int empty = 1;
for(String str:whzdstr.split("-"))
{
cell = sheet.getCell(j,i);
isql+="'"+cell.getContents()+"',";
String content = cell.getContents()==null?"":cell.getContents();
if(!"".equals(content.trim()))
{
empty = 0;
}
j++;
}
if(empty==1)continue;
isql = isql.substring(0,isql.length()-1);
isql+=")";
PrintWriter wrt = null;
try {
//request.get
wrt = response.getWriter();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
wrt.write(str);
}
return "";
}
public Connection getConn()
{
try
{
String d = new Date().toLocaleString().substring(0,9);
//Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
//String dburl = (String)config.get("dburl");
//String user = (String)config.get("username");
//String pwd = (String)config.get("password");
//String dataname=(String)config.get("dataname");
//dburl = dburl+dataname;
//conn = DriverManager.getConnection(dburl,user,pwd);
//String d = new Date().toLocaleString().substring(0,9);
Class.forName((String)config.get("driverClassName"));
String dburl = (String)config.get("dburl");
conn = DriverManager.getConnection(dburl,config.get("username").toString(),config.get("password").toString());
}
catch(Exception e)
{
e.printStackTrace();
}
return conn;
}
public int getInt(String sql)
{
int i = 0;
try {
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(sql);
if(rs.next())
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setSizeMax(100*1024*1024);
List items = new ArrayList();
items = upload.parseRequest(request);
FileItem fileItem = (FileItem) items.get(0);
if(fileItem.getName()!=null && fileItem.getSize()!=0)
{
if(fileItem.getName()!=null && fileItem.getSize()!=0){
File fullFile = new File(fileItem.getName());
filename = Info.generalFileName(fullFile.getName());
File newFile = new File(request.getRealPath("/upfile/")+"/" + filename);
try {
fileItem.write(newFile);
} catch (Exception e) {
e.printStackTrace();
}
}else{
}
}
}
go("/js/uploadimg.jsp?filename="+filename, request, response);
} catch (Exception e1) {
e1.printStackTrace();
}
}
if(ac.equals("uploadimg2"))
{
try {
String filename="";
request.setCharacterEncoding("utf-8");
RequestContext requestContext = new ServletRequestContext(request);
if(FileUpload.isMultipartContent(requestContext)){
DiskFileItemFactory factory = new DiskFileItemFactory();
factory.setRepository(new File(request.getRealPath("/upfile/")+"/"));
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setSizeMax(100*1024*1024);
List items = new ArrayList();
items = upload.parseRequest(request);
FileItem fileItem = (FileItem) items.get(0);
if(fileItem.getName()!=null && fileItem.getSize()!=0)
public Connection getConn()
{
try
{
String d = new Date().toLocaleString().substring(0,9);
//Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
//String dburl = (String)config.get("dburl");
//String user = (String)config.get("username");
//String pwd = (String)config.get("password");
//String dataname=(String)config.get("dataname");
//dburl = dburl+dataname;
//conn = DriverManager.getConnection(dburl,user,pwd);
//String d = new Date().toLocaleString().substring(0,9);
Class.forName((String)config.get("driverClassName"));
String dburl = (String)config.get("dburl");
conn = DriverManager.getConnection(dburl,config.get("username").toString(),config.get("password").toString());
}
catch(Exception e)
{
e.printStackTrace();
}
return conn;
}
public int getInt(String sql)
{
int i = 0;
try {
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(sql);
if(rs.next())
{
i = rs.getInt(1);
}
st.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return i;
}
this.pageNumber = count % this.pageSize == 0 ? this.count
/ this.pageSize : this.count / this.pageSize + 1;
if (this.currentPage > this.pageNumber)
this.currentPage = (int) this.pageNumber;
}
this.request.getSession().setAttribute("currentPage",
String.valueOf(this.currentPage));
this.collection = this.dao.select(hql,
this.currentPage , this.pageSize);
this.refreshUrl();
}
/**
*
* @param 查询条件集合
* 如没有条件只是列表就不使用这个方法
*/
public void addParameter(List parameter) {
StringBuffer para = new StringBuffer("");
if (parameter != null && parameter.size() != 0) {
Iterator iterator = parameter.iterator();
while (iterator.hasNext()) {
para.append("&").append(iterator.next().toString());
}
}
this.parameter = para.toString();
}
/**
* 刷新分页路径
*
*/
protected void refreshUrl() {
StringBuffer buf = new StringBuffer();
buf.append("<font color='#1157B7'>共").append(count);
buf.append("条");
buf.append(" ");
buf.append("第").append(this.currentPage).append("/").append(
this.pageNumber).append("页");
buf.append(" ");
if (this.currentPage == 1)
buf.append("首页");
else
buf.append("<a href='").append(this.path).append("¤tPage=1")
.append(parameter)
.append("' class='ls'>").append("首页")
.append("</a>");
// #1157B7
buf.append(" ");
* @param 下一页的分页链接
* @param 一页最大记录数
* @param 当前HttpServletRequest对象
* @param 数据库操作对象
*/
public static PageManager getPage(String path, int pageSize,
HttpServletRequest request) {
return new PageManager(path, pageSize, request);
}
/**
*
*
* @param hql语句
*
*/
public void doList(String hql) {
this.count = this.dao.select(hql).size();
if (this.count != 0) {
this.pageNumber = count % this.pageSize == 0 ? this.count
/ this.pageSize : this.count / this.pageSize + 1;
if (this.currentPage > this.pageNumber)
this.currentPage = (int) this.pageNumber;
}
this.request.getSession().setAttribute("currentPage",
String.valueOf(this.currentPage));
this.collection = this.dao.select(hql,
this.currentPage , this.pageSize);
this.refreshUrl();
}
/**
*
* @param 查询条件集合
* 如没有条件只是列表就不使用这个方法
*/
public void addParameter(List parameter) {
StringBuffer para = new StringBuffer("");
public class MainCtrl extends HttpServlet {
public MainCtrl() {
super();
}
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doPost(request, response);
}
public void go(String url,HttpServletRequest request, HttpServletResponse response)
{
try {
request.getRequestDispatcher(url).forward(request, response);
} catch (ServletException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
public void gor(String url,HttpServletRequest request, HttpServletResponse response)
{
try {
response.sendRedirect(url);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
fos = response.getOutputStream();
bos = new BufferedOutputStream(fos);
int bytesRead = 0;
byte[] buffer = new byte[5 * 1024];
while ((bytesRead = bis.read(buffer)) != -1) {
bos.write(buffer, 0, bytesRead);
}
bos.close();
bis.close();
fos.close();
} catch (Exception e) {
e.printStackTrace();
}finally{
}
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}
}
public class SetChar extends HttpServlet implements Filter {
private FilterConfig filterConfig;
// Handle the passed-in FilterConfig
public void init(FilterConfig filterConfig) throws ServletException {
this.filterConfig = filterConfig;
}
String filename="";
request.setCharacterEncoding("utf-8");
RequestContext requestContext = new ServletRequestContext(request);
if(FileUpload.isMultipartContent(requestContext)){
DiskFileItemFactory factory = new DiskFileItemFactory();
factory.setRepository(new File(request.getRealPath("/upfile/")+"/"));
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setSizeMax(100*1024*1024);
List items = new ArrayList();
items = upload.parseRequest(request);
FileItem fileItem = (FileItem) items.get(0);
if(fileItem.getName()!=null && fileItem.getSize()!=0)
{
if(fileItem.getName()!=null && fileItem.getSize()!=0){
File fullFile = new File(fileItem.getName());
filename = Info.generalFileName(fullFile.getName());
File newFile = new File(request.getRealPath("/upfile/")+"/" + filename);
try {
fileItem.write(newFile);
} catch (Exception e) {
e.printStackTrace();
}
}else{
}
}
}
go("/js/uploadimg.jsp?filename="+filename, request, response);
} catch (Exception e1) {
e1.printStackTrace();
}
}
if(ac.equals("uploadimg2"))
{
try {
String filename="";
public static String getImgUpInfo(int height)
{
String jscode = "";
jscode+="<img style=\"cursor: hand\" οnclick=\"uploadimg()\" src=\"/jsp_qzzp_sys/js/nopic.jpg\" id=txt height=\""+height+"\"/>";
jscode+="<input type=hidden name=\"filename\" id=\"filename\" value=\"\" />";
return jscode;
}
public static String getImgUpInfo2(int height)
{
String jscode = "";
jscode+="<img style=\"cursor: hand\" οnclick=\"uploadimg2()\" src=\"/jsp_qzzp_sys/js/nopic.jpg\" id=txt2 height=\""+height+"\"/>";
jscode+="<input type=hidden name=\"filename2\" id=\"filename2\" value=\"\" />";
return jscode;
}
public static String getImgUpInfo3(int height)
{
String jscode = "";
jscode+="<img style=\"cursor: hand\" οnclick=\"uploadimg3()\" src=\"/jsp_qzzp_sys/js/nopic.jpg\" id=txt3 height=\""+height+"\"/>";
jscode+="<input type=hidden name=\"filename3\" id=\"filename3\" value=\"\" />";
return jscode;
}
public static String getImgUpInfo4(int height)
{
String jscode = "";
jscode+="<img style=\"cursor: hand\" οnclick=\"uploadimg4()\" src=\"/jsp_qzzp_sys/js/nopic.jpg\" id=txt4 height=\""+height+"\"/>";
jscode+="<input type=hidden name=\"filename4\" id=\"filename4\" value=\"\" />";
return jscode;
}
public static String getImgUpInfo5(int height)
{
String jscode = "";
jscode+="<img style=\"cursor: hand\" οnclick=\"uploadimg5()\" src=\"/jsp_qzzp_sys/js/nopic.jpg\" id=txt5 height=\""+height+"\"/>";
jscode+="<input type=hidden name=\"filename5\" id=\"filename5\" value=\"\" />";
return jscode;
}
}
}
go("/js/uploadimg3.jsp?filename="+filename, request, response);
} catch (Exception e1) {
e1.printStackTrace();
}
}
if(ac.equals("uploadimg4"))
{
try {
String filename="";
request.setCharacterEncoding("utf-8");
RequestContext requestContext = new ServletRequestContext(request);
if(FileUpload.isMultipartContent(requestContext)){
DiskFileItemFactory factory = new DiskFileItemFactory();
factory.setRepository(new File(request.getRealPath("/upfile/")+"/"));
ServletFileUpload upload = new ServletFileUpload(factory);
upload.setSizeMax(100*1024*1024);
List items = new ArrayList();
items = upload.parseRequest(request);
FileItem fileItem = (FileItem) items.get(0);
if(fileItem.getName()!=null && fileItem.getSize()!=0)
{
if(fileItem.getName()!=null && fileItem.getSize()!=0){
File fullFile = new File(fileItem.getName());
filename = Info.generalFileName(fullFile.getName());
File newFile = new File(request.getRealPath("/upfile/")+"/" + filename);
try {
fileItem.write(newFile);
} catch (Exception e) {
e.printStackTrace();
}
}else{
}
}
}
go("/js/uploadimg4.jsp?filename="+filename, request, response);
} catch (Exception e1) {
e1.printStackTrace();
}
String jscode = "";
jscode+="<img style=\"cursor: hand\" οnclick=\"uploadimg2()\" src=\"/jsp_qzzp_sys/js/nopic.jpg\" id=txt2 height=\""+height+"\"/>";
jscode+="<input type=hidden name=\"filename2\" id=\"filename2\" value=\"\" />";
return jscode;
}
public static String getImgUpInfoext3(int height)
{
String jscode = "";
jscode+="<img style=\"cursor: hand\" οnclick=\"uploadimg3()\" src=\"/jsp_qzzp_sys/js/nopic.jpg\" id=txt3 height=\""+height+"\"/>";
jscode+="<input type=hidden name=\"filename3\" id=\"filename3\" value=\"\" />";
return jscode;
}
public static String getImgUpInfo(int height)
{
String jscode = "";
jscode+="<img style=\"cursor: hand\" οnclick=\"uploadimg()\" src=\"/jsp_qzzp_sys/js/nopic.jpg\" id=txt height=\""+height+"\"/>";
jscode+="<input type=hidden name=\"filename\" id=\"filename\" value=\"\" />";
return jscode;
}
public static String getImgUpInfo2(int height)
{
String jscode = "";
jscode+="<img style=\"cursor: hand\" οnclick=\"uploadimg2()\" src=\"/jsp_qzzp_sys/js/nopic.jpg\" id=txt2 height=\""+height+"\"/>";
jscode+="<input type=hidden name=\"filename2\" id=\"filename2\" value=\"\" />";
return jscode;
}
public static String getImgUpInfo3(int height)
{
String jscode = "";
jscode+="<img style=\"cursor: hand\" οnclick=\"uploadimg3()\" src=\"/jsp_qzzp_sys/js/nopic.jpg\" id=txt3 height=\""+height+"\"/>";
jscode+="<input type=hidden name=\"filename3\" id=\"filename3\" value=\"\" />";
// if (this.currentPage == i + 1) {
// buf.append("<font color=red>[" + (i + 1) + "]</font>").append(
// " ");
// } else {
// buf.append("<a href='").append(this.path).append(
// "¤tPage=").append(i + 1).append(parameter)
// .append("' style='TEXT-DECORATION:none'>").append(
// "[" + (i + 1) + "]").append("</a> ");
// }
// }
buf.append("<select οnchange=\"javascript:window.location='").append(
this.path).append("¤tPage='+").append(
"this.options[this.selectedIndex].value").append(parameter)
.append("\">");
for (int i = 0; i < this.pageNumber; i++) {
if (this.currentPage == i + 1)
buf.append("<option value=" + (i + 1)
+ " selected=\"selected\">" + (i + 1) + "</option>");
else
buf.append("<option value=" + (i + 1) + ">" + (i + 1)
+ "</option>");
}
buf.append("</select>");
this.info = buf.toString();
}
public Collection getCollection() {
return collection;
}
public long getCount() {
return count;
}
public int getCurrentPage() {
return currentPage;
}
public long getPageNumber() {
*/
protected void refreshUrl() {
StringBuffer buf = new StringBuffer();
buf.append("<font color='#1157B7'>共").append(count);
buf.append("条");
buf.append(" ");
buf.append("第").append(this.currentPage).append("/").append(
this.pageNumber).append("页");
buf.append(" ");
if (this.currentPage == 1)
buf.append("首页");
else
buf.append("<a href='").append(this.path).append("¤tPage=1")
.append(parameter)
.append("' class='ls'>").append("首页")
.append("</a>");
// #1157B7
buf.append(" ");
if (this.currentPage > 1) {
buf.append("<a href='").append(this.path).append("¤tPage=")
.append(currentPage - 1).append(parameter).append(
"' class='ls'>").append("上页")
.append("</a>");
} else {
buf.append("上页");
}
buf.append(" ");
int currentSegment = this.currentPage % segment == 0 ? this.currentPage
/ segment : this.currentPage / segment + 1;
/*for (int i = 1; i <= this.pageNumber; i++) {
if (this.currentPage == i)
buf.append("<font color='red'>").append(i).append("</font>");
else
buf.append("<a href='").append(this.path).append(
"¤tPage=").append(i).append(parameter).append(
"' class='ls'>[").append(i).append(
"]</a>");
}*/