Java Jsp+Servlet+mysql实现的在线招聘系统(系统管理员/企业用户/学生 功能:招聘信息、投递简历、筛选简历、面试资料下载、就业信息、就业新闻、留言板等)
博客目录JSP在线招聘系统实现功能截图技术点总结:代码写在最后JSP在线招聘系统本系统是一套用户学生和企业投递简历以及筛选人才的网站,包含常用的招聘网站功能,美观实用。实现功能截图用户未登录系统首页:用户登录成功提示:用户登录成功:留言板:个人管理中心:资料下载:就业信息:技术点总结:jsp、Servletjdk版本:1.7tomcat: 7.0数据库:mysql开发工具:eclipse项目包结构
·
JSP在线招聘系统
本系统是一套用户学生和企业投递简历以及筛选人才的网站,包含常用的招聘网站功能,美观实用。
实现功能截图
用户未登录系统首页:
用户登录成功提示:
用户登录成功:
留言板:
个人管理中心:
资料下载:
就业信息:
技术点总结:
jsp、Servlet
jdk版本:1.7
tomcat: 7.0
数据库:mysql
开发工具:eclipse
项目包结构分类清晰:
代码
model类:
TAdmin.java:
package com.model;
/**
* TAdmin generated by MyEclipse Persistence Tools
*/
public class TAdmin implements java.io.Serializable {
// Fields
private Integer userId;
private String userName;
private String userPw;
// Constructors
/** default constructor */
public TAdmin() {
}
/** full constructor */
public TAdmin(String userName, String userPw) {
this.userName = userName;
this.userPw = userPw;
}
// Property accessors
public String getUserName() {
return this.userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getUserPw() {
return this.userPw;
}
public void setUserPw(String userPw) {
this.userPw = userPw;
}
public Integer getUserId()
{
return userId;
}
public void setUserId(Integer userId)
{
this.userId = userId;
}
}
TStu.java:
package com.model;
/**
* TStu generated by MyEclipse Persistence Tools
*/
public class TStu implements java.io.Serializable
{
private Integer stuId;
private String stuXuehao;
private String stuRealname;
private String stuSex;
private String stuAge;
private String loginName;
private String loginPw;
private String del;
public String getDel()
{
return del;
}
public void setDel(String del)
{
this.del = del;
}
public String getLoginName()
{
return loginName;
}
public void setLoginName(String loginName)
{
this.loginName = loginName;
}
public String getLoginPw()
{
return loginPw;
}
public void setLoginPw(String loginPw)
{
this.loginPw = loginPw;
}
public String getStuAge()
{
return stuAge;
}
public void setStuAge(String stuAge)
{
this.stuAge = stuAge;
}
public Integer getStuId()
{
return stuId;
}
public void setStuId(Integer stuId)
{
this.stuId = stuId;
}
public String getStuRealname()
{
return stuRealname;
}
public void setStuRealname(String stuRealname)
{
this.stuRealname = stuRealname;
}
public String getStuSex()
{
return stuSex;
}
public void setStuSex(String stuSex)
{
this.stuSex = stuSex;
}
public String getStuXuehao()
{
return stuXuehao;
}
public void setStuXuehao(String stuXuehao)
{
this.stuXuehao = stuXuehao;
}
}
dao层:
TAdminDAO.java:
package com.dao;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.model.TAdmin;
/**
* Data access object (DAO) for domain model class TAdmin.
*
* @see com.model.TAdmin
* @author MyEclipse Persistence Tools
*/
public class TAdminDAO extends HibernateDaoSupport {
private static final Log log = LogFactory.getLog(TAdminDAO.class);
// property constants
public static final String USER_NAME = "userName";
public static final String USER_PW = "userPw";
protected void initDao() {
// do nothing
}
public void save(TAdmin transientInstance) {
log.debug("saving TAdmin instance");
try {
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re) {
log.error("save failed", re);
throw re;
}
}
public void delete(TAdmin persistentInstance) {
log.debug("deleting TAdmin instance");
try {
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re) {
log.error("delete failed", re);
throw re;
}
}
public TAdmin findById(java.lang.Integer id) {
log.debug("getting TAdmin instance with id: " + id);
try {
TAdmin instance = (TAdmin) getHibernateTemplate().get(
"com.model.TAdmin", id);
return instance;
} catch (RuntimeException re) {
log.error("get failed", re);
throw re;
}
}
public List findByExample(TAdmin instance) {
log.debug("finding TAdmin instance by example");
try {
List results = getHibernateTemplate().findByExample(instance);
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re) {
log.error("find by example failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value) {
log.debug("finding TAdmin instance with property: " + propertyName
+ ", value: " + value);
try {
String queryString = "from TAdmin as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re) {
log.error("find by property name failed", re);
throw re;
}
}
public List findByUserName(Object userName) {
return findByProperty(USER_NAME, userName);
}
public List findByUserPw(Object userPw) {
return findByProperty(USER_PW, userPw);
}
public List findAll() {
log.debug("finding all TAdmin instances");
try {
String queryString = "from TAdmin";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re) {
log.error("find all failed", re);
throw re;
}
}
public TAdmin merge(TAdmin detachedInstance) {
log.debug("merging TAdmin instance");
try {
TAdmin result = (TAdmin) getHibernateTemplate().merge(
detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re) {
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(TAdmin instance) {
log.debug("attaching dirty TAdmin instance");
try {
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public void attachClean(TAdmin instance) {
log.debug("attaching clean TAdmin instance");
try {
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re) {
log.error("attach failed", re);
throw re;
}
}
public static TAdminDAO getFromApplicationContext(ApplicationContext ctx) {
return (TAdminDAO) ctx.getBean("TAdminDAO");
}
}
TStuDAO.java:
package com.dao;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.springframework.context.ApplicationContext;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import com.model.TStu;
/**
* Data access object (DAO) for domain model class TStu.
*
* @see com.model.TStu
* @author MyEclipse Persistence Tools
*/
public class TStuDAO extends HibernateDaoSupport
{
private static final Log log = LogFactory.getLog(TStuDAO.class);
// property constants
public static final String STU_XUEHAO = "stuXuehao";
public static final String STU_REALNAME = "stuRealname";
public static final String STU_SEX = "stuSex";
public static final String STU_AGE = "stuAge";
public static final String STU_CARD = "stuCard";
public static final String STU_ZHENGZHIMIANMAO = "stuZhengzhimianmao";
public static final String LOGIN_NAME = "loginName";
public static final String LOGIN_PW = "loginPw";
public static final String DEL = "del";
protected void initDao()
{
// do nothing
}
public void save(TStu transientInstance)
{
log.debug("saving TStu instance");
try
{
getHibernateTemplate().save(transientInstance);
log.debug("save successful");
} catch (RuntimeException re)
{
log.error("save failed", re);
throw re;
}
}
public void delete(TStu persistentInstance)
{
log.debug("deleting TStu instance");
try
{
getHibernateTemplate().delete(persistentInstance);
log.debug("delete successful");
} catch (RuntimeException re)
{
log.error("delete failed", re);
throw re;
}
}
public TStu findById(java.lang.Integer id)
{
log.debug("getting TStu instance with id: " + id);
try
{
TStu instance = (TStu) getHibernateTemplate().get("com.model.TStu",
id);
return instance;
} catch (RuntimeException re)
{
log.error("get failed", re);
throw re;
}
}
public List findByExample(TStu instance)
{
log.debug("finding TStu instance by example");
try
{
List results = getHibernateTemplate().findByExample(instance);
log.debug("find by example successful, result size: "
+ results.size());
return results;
} catch (RuntimeException re)
{
log.error("find by example failed", re);
throw re;
}
}
public List findByProperty(String propertyName, Object value)
{
log.debug("finding TStu instance with property: " + propertyName
+ ", value: " + value);
try
{
String queryString = "from TStu as model where model."
+ propertyName + "= ?";
return getHibernateTemplate().find(queryString, value);
} catch (RuntimeException re)
{
log.error("find by property name failed", re);
throw re;
}
}
public List findByStuXuehao(Object stuXuehao)
{
return findByProperty(STU_XUEHAO, stuXuehao);
}
public List findByStuRealname(Object stuRealname)
{
return findByProperty(STU_REALNAME, stuRealname);
}
public List findByStuSex(Object stuSex)
{
return findByProperty(STU_SEX, stuSex);
}
public List findByStuAge(Object stuAge)
{
return findByProperty(STU_AGE, stuAge);
}
public List findByStuCard(Object stuCard)
{
return findByProperty(STU_CARD, stuCard);
}
public List findByStuZhengzhimianmao(Object stuZhengzhimianmao)
{
return findByProperty(STU_ZHENGZHIMIANMAO, stuZhengzhimianmao);
}
public List findByLoginName(Object loginName)
{
return findByProperty(LOGIN_NAME, loginName);
}
public List findByLoginPw(Object loginPw)
{
return findByProperty(LOGIN_PW, loginPw);
}
public List findByDel(Object del)
{
return findByProperty(DEL, del);
}
public List findAll()
{
log.debug("finding all TStu instances");
try
{
String queryString = "from TStu";
return getHibernateTemplate().find(queryString);
} catch (RuntimeException re)
{
log.error("find all failed", re);
throw re;
}
}
public TStu merge(TStu detachedInstance)
{
log.debug("merging TStu instance");
try
{
TStu result = (TStu) getHibernateTemplate().merge(detachedInstance);
log.debug("merge successful");
return result;
} catch (RuntimeException re)
{
log.error("merge failed", re);
throw re;
}
}
public void attachDirty(TStu instance)
{
log.debug("attaching dirty TStu instance");
try
{
getHibernateTemplate().saveOrUpdate(instance);
log.debug("attach successful");
} catch (RuntimeException re)
{
log.error("attach failed", re);
throw re;
}
}
public void attachClean(TStu instance)
{
log.debug("attaching clean TStu instance");
try
{
getHibernateTemplate().lock(instance, LockMode.NONE);
log.debug("attach successful");
} catch (RuntimeException re)
{
log.error("attach failed", re);
throw re;
}
}
public static TStuDAO getFromApplicationContext(ApplicationContext ctx)
{
return (TStuDAO) ctx.getBean("TStuDAO");
}
}
action层:
adminAction.java:
package com.action;
import java.util.List;
import java.util.Map;
import org.apache.struts2.ServletActionContext;
import com.dao.TAdminDAO;
import com.model.TAdmin;
import com.opensymphony.xwork2.ActionSupport;
public class adminAction extends ActionSupport
{
private int userId;
private String userName;
private String userPw;
private String message;
private String path;
private int index=1;
private TAdminDAO adminDAO;
public String adminAdd()
{
TAdmin admin=new TAdmin();
admin.setUserName(userName);
admin.setUserPw(userPw);
adminDAO.save(admin);
this.setMessage("操作成功");
this.setPath("adminManage.action");
return "succeed";
}
public String adminManage()
{
List adminList=adminDAO.findAll();
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("adminList", adminList);
return ActionSupport.SUCCESS;
}
public String adminDel()
{
adminDAO.delete(adminDAO.findById(userId));
this.setMessage("删除成功");
this.setPath("adminManage.action");
return "succeed";
}
public TAdminDAO getAdminDAO()
{
return adminDAO;
}
public void setAdminDAO(TAdminDAO adminDAO)
{
this.adminDAO = adminDAO;
}
public String getMessage()
{
return message;
}
public int getIndex()
{
return index;
}
public void setIndex(int index)
{
this.index = index;
}
public void setMessage(String message)
{
this.message = message;
}
public String getPath()
{
return path;
}
public void setPath(String path)
{
this.path = path;
}
public int getUserId()
{
return userId;
}
public void setUserId(int userId)
{
this.userId = userId;
}
public String getUserName()
{
return userName;
}
public void setUserName(String userName)
{
this.userName = userName;
}
public String getUserPw()
{
return userPw;
}
public void setUserPw(String userPw)
{
this.userPw = userPw;
}
}
stuAction.java:
package com.action;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import com.dao.TStuDAO;
import com.model.TStu;
import com.opensymphony.xwork2.ActionSupport;
public class stuAction extends ActionSupport
{
private Integer stuId;
private String stuXuehao;
private String stuRealname;
private String stuSex;
private String stuAge;
private String loginName;
private String loginPw;
private String del;
private String message;
private String path;
private TStuDAO stuDAO;
public String stuAdd()
{
TStu stu=new TStu();
stu.setStuXuehao(stuXuehao);
stu.setStuRealname(stuRealname);
stu.setStuSex(stuSex);
stu.setStuAge(stuAge);
stu.setLoginName(loginName);
stu.setLoginPw(loginPw);
stu.setDel("no");
stuDAO.save(stu);
HttpServletRequest request=ServletActionContext.getRequest();
request.setAttribute("msg", "注册成功,请登录");
return "msg";
}
public String stuDel()
{
TStu stu=stuDAO.findById(stuId);
stu.setDel("yes");
stuDAO.attachDirty(stu);
this.setMessage("删除成功");
this.setPath("stuMana.action");
return "succeed";
}
public String stuMana()
{
List stuList=stuDAO.getHibernateTemplate().find("from TStu where del='no'");
Map request=(Map)ServletActionContext.getContext().get("request");
request.put("stuList", stuList);
return ActionSupport.SUCCESS;
}
public String stuEditByMe()
{
Map session= ServletActionContext.getContext().getSession();
TStu stu=(TStu)session.get("stu");
stu.setStuXuehao(stuXuehao);
stu.setStuRealname(stuRealname);
stu.setStuSex(stuSex);
stu.setStuAge(stuAge);
stu.setLoginName(loginName);
stu.setLoginPw(loginPw);
stu.setDel("no");
stuDAO.attachDirty(stu);
session.put("stu", stu);
this.setMessage("操作成功");
this.setPath("astu/userinfo/stuinfo.jsp");
return "succeed";
}
public String getDel()
{
return del;
}
public void setDel(String del)
{
this.del = del;
}
public String getLoginName()
{
return loginName;
}
public void setLoginName(String loginName)
{
this.loginName = loginName;
}
public String getLoginPw()
{
return loginPw;
}
public void setLoginPw(String loginPw)
{
this.loginPw = loginPw;
}
public String getMessage()
{
return message;
}
public void setMessage(String message)
{
this.message = message;
}
public String getPath()
{
return path;
}
public void setPath(String path)
{
this.path = path;
}
public String getStuAge()
{
return stuAge;
}
public void setStuAge(String stuAge)
{
this.stuAge = stuAge;
}
public TStuDAO getStuDAO()
{
return stuDAO;
}
public void setStuDAO(TStuDAO stuDAO)
{
this.stuDAO = stuDAO;
}
public Integer getStuId()
{
return stuId;
}
public void setStuId(Integer stuId)
{
this.stuId = stuId;
}
public String getStuRealname()
{
return stuRealname;
}
public void setStuRealname(String stuRealname)
{
this.stuRealname = stuRealname;
}
public String getStuSex()
{
return stuSex;
}
public void setStuSex(String stuSex)
{
this.stuSex = stuSex;
}
public String getStuXuehao()
{
return stuXuehao;
}
public void setStuXuehao(String stuXuehao)
{
this.stuXuehao = stuXuehao;
}
}
写在最后
码代码不容易,需要的同学可以参考学习,全部代码不能都贴出,如果需要可以+博主V交流获取(Code2Life2)
最后,别忘了一键三连哦
更多推荐
已为社区贡献2条内容
所有评论(0)