基于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
str+="parent.location=parent.location;\n";
}
str+="</script>\n";
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());
}
String filename = request.getParameter("filename");
if (request.getHeader("User-Agent").toLowerCase().indexOf("firefox") > 0){
try {
filename = new String(filename.getBytes("UTF-8"), "ISO8859-1");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
else
if (request.getHeader("User-Agent").toUpperCase().indexOf("MSIE") > 0){
try {
filename = URLEncoder.encode(filename, "UTF-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
response.setContentType("text/plain");
response.setHeader("Location",filename);
response.reset();
response.setHeader("Cache-Control", "max-age=0" );
response.setHeader("Content-Disposition", "attachment; filename=" + filename);
try {
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
OutputStream fos = null;
// File f = new File(request.getRealPath("/upfile/")+"/"+filename);
//System.out.println(f);
bis = new BufferedInputStream((InputStream)new FileInputStream(request.getRealPath("/upfile/")+"/"+filename));
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{
}
}
}catch(Exception e){
}
return dateString;
}
public static String getUTFStr(String str) {
if(str==null){
return "";
}
try {
str = new String(str.getBytes("ISO-8859-1"),"utf-8");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return str;
}
public static String getGBKStr(String str) throws UnsupportedEncodingException{
if(str==null){
return "";
}
return new String(str.getBytes("ISO-8859-1"),"GBK");
}
public static String getGB2312Str(String str) throws UnsupportedEncodingException{
if(str==null){
return "";
}
return new String(str.getBytes("ISO-8859-1"),"gb2312");
}
/**
* @param String date
* @param int day
String select = "<select name=\""+name+"\" id=\""+name+"\" >";
select+="<option value=\"\">不限</option>";
for(HashMap permap:new CommDAO().select("select * from "+tablename+" where "+where+" order by id desc")){
String optionstr = "";
if(zdname.split(";").length==1){
optionstr=permap.get(zdname.split("~")[0]).toString();
}else{
for(String str:zdname.split(";"))
{
String zdstr = str.split("~")[0];
String zdnamestr = str.split("~")[1].equals("无名")?"":(str.split("~")[1]+":");
optionstr+=zdnamestr+permap.get(zdstr)+" - ";
}
}
if(optionstr.indexOf(" - ")>-1)optionstr=optionstr.substring(0,optionstr.length()-3);
select+="<option value=\""+optionstr+"\">"+optionstr+"</option>";
}
select+="</select>";
return select;
}
public static String getradio(String name,String tablename,String zdname,String where)
{
String radio="";
int dxii = 0;
for(HashMap permap:new CommDAO().select("select * from "+tablename+" where "+where+" order by id desc")){
String check="";
if(dxii==0)check="checked=checked";
String optionstr = "";
for(String str:zdname.split(";"))
{
String zdstr = str.split("~")[0];
String zdnamestr = str.split("~")[1].equals("无名")?"":(str.split("~")[1]+":");
optionstr+=zdnamestr+permap.get(zdstr)+" - ";
}
int columns = sheet.getColumns();
for (int r = 0; r < rows; r++) {
String[] rowDates = new String[columns];
if(r>0)
{
System.out.println("这是第"+r+"行");
String uname = sheet.getCell(0, r).getContents();
String upass = sheet.getCell(1, r).getContents();
String tname = sheet.getCell(2, r).getContents();
String sex = sheet.getCell(3, r).getContents();
String qq = sheet.getCell(4, r).getContents();
String email = sheet.getCell(5, r).getContents();
// ArrayList<HashMap> lll = (ArrayList)dao.select("select * from teacher where tno="+tno);
// if(lll.size()==0){
String sql = "insert into sysuser (uname,upass,tname,sex,qq,email,utype,savetime) " +
" values ('"+uname+"','"+upass+"','"+tname+"','"+sex+"','"+qq+"','"+email+"','"+utype+"','"+savetime+"')";
System.out.println(sql);
dao.commOper(sql);
// }else{
// request.setAttribute("no", "");
// go("/addjspl.jsp", request, response);
// }
}
for (int c = 0; c < columns; c++) {
Cell cell = sheet.getCell(c, r);
String cellValue = cell.getContents();
rowDates[c] = cellValue;
}
result.add(rowDates);
}
excel.close();
} catch (Exception e) {
System.out.println(e.getMessage());
}
/*String sql = "insert into kq values (null,'"+sno+"','"+kcname+"','"+remark+"','"+time+"','"+tid+"')";
*/
request.setAttribute("suc", "");
go("/admin/addxspl.jsp", request, response);
}
dao.close();
out.flush();
out.close();
}
public void init() throws ServletException {
// Put your code here
}
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;
}
public static String fck(int height,String content)
{
public class PageManager {
private PageManager() {
}
// 默认一页最大记录数
public static final int DEFAULTPAGESIZE = 20;
// 分页段
public static final int segment = 10;
// 当前页数
protected int currentPage;
// 一页长度
protected int pageSize;
// 总页数
protected long pageNumber;
// 总记录数
protected long count;
// 数据
protected Collection collection;
// 数据查询对象
protected CommDAO dao = new CommDAO();
// 表现层代码
protected String info;
// 请求路径
protected String path;
// 服务器请求对象
protected HttpServletRequest request;
/*
* 仅仅只是加到路径中去
*/
e.printStackTrace();
}
String str = "";
if(!reflush)
str += "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"> \n";
str += "<script language=javascript>\n";
if(alert){
str+="alert('操作成功');\n";
}
if(reflush){
str+="parent.location=parent.location;\n";
}
str+="</script>";
PrintWriter wrt = null;
try {
wrt = response.getWriter();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
wrt.write(str);
}
return "";
}
public void delete(HttpServletRequest request,String tablename)
{
int i = 0;
try {
String did = request.getParameter("did");
if(did==null)did = request.getParameter("scid");
if(did!=null){
if(did.length()>0){
Statement st = conn.createStatement();
st.execute("delete from "+tablename+" where id="+did);
st.close();
}
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public String getCols(String table)
{
String str = "";
Connection conn = this.getConn();
try {
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("select * from "+table);
ResultSetMetaData rsmd = rs.getMetaData();
int i = rsmd.getColumnCount();
for(int j=2;j<=i;j++)
{
str+=rsmd.getColumnName(j)+",";
}
}catch (Exception e) {
e.printStackTrace();
}
str = str.substring(0,str.length()-1);
return str;
}
public String update(HttpServletRequest request,HttpServletResponse response, String tablename,HashMap extmap,boolean alert,boolean reflush )
{
if(request.getParameter("f")!=null){
Enumeration enumeration = request.getParameterNames();
String names = ",";
while(enumeration.hasMoreElements())
{
names += enumeration.nextElement().toString()+",";
}
HashMap typemap = new HashMap();
ArrayList<String> collist = new ArrayList();
String sql = "update "+tablename+" set ";
Connection conn = this.getConn();
try {
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("select * from "+tablename);
ResultSetMetaData rsmd = rs.getMetaData();
int i = rsmd.getColumnCount();
System.out.println(i);
for(int j=1;j<=i;j++)
{
if(rsmd.getColumnName(j).equals("id"))continue;
jscode+="{\n";
Set set = map.entrySet();
Iterator it = set.iterator();
while(it.hasNext())
{
String pm=((Object)it.next()).toString();
String str1 = "";
String str2 = "";
String[] strs = pm.split("=");
str1 = strs[0];
if(strs.length==1)str2="";
if(strs.length==2)str2=strs[1];
str2 = str2.replaceAll("\r\n", "-----");
if(!str1.equals("content")){
jscode+=" if(document.getElementsByName(\""+str1+"\").length>1)\n";
jscode+=" {\n";
jscode+=" var radios = document.getElementsByName(\""+str1+"\");\n";
jscode+=" if(radios[0].type=='radio'){\n";
jscode+=" for(var i=0;i<radios.length;i++)\n";
jscode+=" {\n";
jscode+=" if(radios[i].value==\""+str2+"\")\n";
jscode+=" {\n";
jscode+=" radios[i].checked=\"checked\";\n";
jscode+=" }\n";
jscode+=" }\n";
jscode+=" }\n";
jscode+=" if(radios[0].type=='checkbox'){\n";
jscode+=" for(var i=0;i<radios.length;i++)\n";
jscode+=" {\n";
jscode+=" if(\""+str2+"\".indexOf(radios[i].value)>-1)\n";
jscode+=" {\n";
jscode+=" radios[i].checked=\"checked\";\n";
if(str2.indexOf(" - ")>-1){
for(String strch:str2.split(" ~ ")){
String strchname = strch.substring(0,strch.lastIndexOf(" - "));
jscode+=" if(document.getElementsByName('"+strchname+"').length>0)\n";
jscode+=" {\n";
jscode+=" document.getElementsByName('"+strchname+"')[0].value='"+strch.substring(strch.lastIndexOf(":")+1)+"';\n";
jscode+=" }\n";
public String getCols(String table)
{
String str = "";
Connection conn = this.getConn();
try {
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("select * from "+table);
ResultSetMetaData rsmd = rs.getMetaData();
int i = rsmd.getColumnCount();
for(int j=2;j<=i;j++)
{
str+=rsmd.getColumnName(j)+",";
}
}catch (Exception e) {
e.printStackTrace();
}
str = str.substring(0,str.length()-1);
return str;
}
public String update(HttpServletRequest request,HttpServletResponse response, String tablename,HashMap extmap,boolean alert,boolean reflush )
{
if(request.getParameter("f")!=null){
Enumeration enumeration = request.getParameterNames();
String names = ",";
while(enumeration.hasMoreElements())
{
names += enumeration.nextElement().toString()+",";
}
HashMap typemap = new HashMap();
ArrayList<String> collist = new ArrayList();
String sql = "update "+tablename+" set ";
Connection conn = this.getConn();
try {
Statement st = conn.createStatement();
}
}
}
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)
{
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/uploadimg2.jsp?filename="+filename, request, response);
} catch (Exception e1) {
*/
request.setAttribute("suc", "");
go("/admin/addxspl.jsp", request, response);
}
dao.close();
out.flush();
out.close();
}
public void init() throws ServletException {
// Put your code here
}
public static void main(String[] args) {
System.out.println(new CommDAO().select("select * from mixinfo"));
}
}
jscode+=" if(radios.type=='select'){\n";
jscode+=" f1."+str1+".value=\""+str2+"\";\n";
jscode+=" }\n";
jscode+=" }else{\n";
jscode+=" if(f1."+str1+")\n";
jscode+="{\n";
jscode+="f1."+str1+".value=\""+str2+"\";\n";
jscode+="}\n";
jscode+="}\n";
jscode+="if(document.getElementById(\"txt\"))\n";
jscode+="{\n";
jscode+="document.getElementById(\"txt\").src=\"/jsp_qzzp_sys/upfile/"+map.get("filename")+"\";\n";
jscode+="}\n";
jscode+="if(document.getElementById(\"txt2\"))\n";
jscode+="{\n";
jscode+="document.getElementById(\"txt2\").src=\"/jsp_qzzp_sys/upfile/"+map.get("filename2")+"\";\n";
jscode+="}\n";
jscode+="if(document.getElementById(\"txt3\"))\n";
jscode+="{\n";
jscode+="document.getElementById(\"txt3\").src=\"/jsp_qzzp_sys/upfile/"+map.get("filename3")+"\";\n";
jscode+="}\n";
jscode+="if(document.getElementById(\"txt4\"))\n";
jscode+="{\n";
jscode+="document.getElementById(\"txt4\").src=\"/jsp_qzzp_sys/upfile/"+map.get("filename4")+"\";\n";
jscode+="}\n";
jscode+="if(document.getElementById(\"txt5\"))\n";
jscode+="{\n";
jscode+="document.getElementById(\"txt5\").src=\"/jsp_qzzp_sys/upfile/"+map.get("filename5")+"\";\n";
jscode+="}\n";
}
}
jscode+="}\n";
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;
}
public static String fck(int height,String content)
{
String jscode = "<TEXTAREA name=\"content\" id=\"content\">"+content+"</TEXTAREA>";
jscode+="<script language=\"javascript\">";
jscode+="function fckinit()";
jscode+="{";
jscode+=" var of = new FCKeditor(\"content\");";
jscode+="of.BasePath=\"/jsp_qzzp_sys/fckeditor/\";";
jscode+="of.Height = \""+height+"\";";
jscode+="of.ToolbarSet=\"Default\";";
String resu = dateFormat.format(grc.getTime());
String t[]= resu.split("-");
String sesuu = "";
for(int i=0;i<t.length;i++)
{
if(t[i].length()==1)
{
t[i]="0"+t[i];
}
sesuu += t[i]+"-";
}
return sesuu.substring(0,10);
}
/**
* 计算两个时期之间的天数
*
*/
public static int dayToday(String DATE1, String DATE2) {
int i = 0;
if(DATE1.indexOf(" ")>-1)
DATE1 = DATE1.substring(0,DATE1.indexOf(" "));
if(DATE2.indexOf(" ")>-1)
DATE2 = DATE2.substring(0,DATE2.indexOf(" "));
String[] d1 = DATE1.split("-");
if(d1[1].length()==1)
{
DATE1 = d1[0]+"-0"+d1[1];
}else{
DATE1 = d1[0]+"-"+d1[1];
}
if(d1[2].length()==1)
{
DATE1 = DATE1+"-0"+d1[2];
}else{
DATE1 = DATE1+"-"+d1[2];
HashMap typemap = new HashMap();
ArrayList<String> collist = new ArrayList();
String sql = "update "+tablename+" set ";
Connection conn = this.getConn();
try {
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery("select * from "+tablename);
ResultSetMetaData rsmd = rs.getMetaData();
int i = rsmd.getColumnCount();
System.out.println(i);
for(int j=1;j<=i;j++)
{
if(rsmd.getColumnName(j).equals("id"))continue;
typemap.put(rsmd.getColumnName(j)+"---", rsmd.getColumnTypeName(j));
collist.add(rsmd.getColumnName(j));
if(names.indexOf(","+rsmd.getColumnName(j)+",")>-1)
{
String[] values = request.getParameterValues(rsmd.getColumnName(j));
String value="";
for(String vstr:values)
{
if(vstr==null)vstr="";
if(vstr.equals("null"))vstr="";
if(vstr.trim().equals(""))continue;
if(request.getParameter(vstr)!=null&&!"".equals(request.getParameter(vstr))&&request.getParameter("dk-"+rsmd.getColumnName(j)+"-value")!=null)
{
String dkv = request.getParameter(vstr);
String dknamevalue = request.getParameter("dk-"+rsmd.getColumnName(j)+"-value");
vstr+=" - "+dknamevalue+":"+dkv;
}
value+=vstr+" ~ ";
}
if(value==null)value="";
if(value.equals("null"))value="";
if(value.length()>0)value=value.substring(0,value.length()-3);
if(rsmd.getColumnTypeName(j).equals("int"))
{
sql+=rsmd.getColumnName(j)+"="+value+",";
}else{
sql+=rsmd.getColumnName(j)+"='"+value+"',";
}
}else{
if(extmap.get(rsmd.getColumnName(j))!=null)
{
if(rsmd.getColumnTypeName(j).equals("int"))