javaweb项目校园失物招领系统struts+spring+hibernate-java课程设计毕业设计
立即下载
资源介绍:
校园失物招领系统的完整源码,采用了广泛使用的Struts、Spring和Hibernate框架。本项目旨在为在校大学生的Java课程设计和毕业设计提供宝贵的学习参考,帮助他们深入理解现代Java开发技术。
校园失物招领系统包含寻物启事管理、招领启事管理、账户管理、网站设置等功能模块,旨在为学生提供一个方便高效的平台,以帮助他们快速找到遗失物品。通过这个项目,学习者将掌握MVC架构设计、数据库管理和Web开发的核心技术。
无论您是Java开发的新手还是希望提升编程能力的技术爱好者,这个项目源码都将是您学习和实践的优质资源。立即下载源码,深入研究,提升您的Java开发技能,让我们共同在编程的道路上不断前进!
package com.daowen.action;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.SQLQuery;
import org.hibernate.Query;
import com.daowen.dal.*;
import com.daowen.bll.*;
import com.daowen.entity.*;
import com.daowen.util.HibernateSessionFactory;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.text.MessageFormat;
import com.daowen.util.PagerMetal;
public class HuiyuanAction extends PageActionBase {
public void onLoad() {
String actiontype = request.getParameter("actiontype");
System.out.println("actiontype=" + actiontype);
if (actiontype.equals("login")) {
login();
}
if (actiontype.equals("exit")) {
exit();
}
if (actiontype.equals("modifyPw")) {
modifyPw();
}
if (actiontype.equals("chongzhi")) {
chongzhi();
}
}
private void chongzhi() {
String jine = request.getParameter("jine");
String forwardurl = request.getParameter("forwardurl");
String id = request.getParameter("id");
if (id == null || id == "")
return;
Huiyuan huiyuan = (Huiyuan) DALBase.load(Huiyuan.class, new Integer(id));
if (huiyuan != null) {
huiyuan.setYue(huiyuan.getYue() + Float.parseFloat(jine));
DALBase.update(huiyuan);
request.getSession().setAttribute("huiyuan", huiyuan);
try {
if (forwardurl != null)
response.sendRedirect(SystemParam.getSiteRoot()
+ forwardurl);
} catch (IOException e) {
e.printStackTrace();
}
}
}
private void modifyPw() {
String password1=request.getParameter("password1");
String forwardurl=request.getParameter("forwardurl");
String repassword1=request.getParameter("repassword1");
String repassword2=request.getParameter("repassword2");
String id = request.getParameter("id");
if (id == null||id=="")
return;
Huiyuan huiyuan = (Huiyuan) DALBase.load(Huiyuan.class, new Integer(id));
if(huiyuan!=null)
{
huiyuan.setPassword(repassword1);
DALBase.update(huiyuan);
request.getSession().setAttribute("huiyuan", huiyuan);
try {
response.sendRedirect(SystemParam.getSiteRoot()+forwardurl);
} catch (IOException e) {
e.printStackTrace();
}
}
}
private void exit() {
if (request.getSession().getAttribute("huiyuan") != null) {
System.out.println("系统退出");
request.getSession().removeAttribute("huiyuan");
}
if(request.getSession().getAttribute("zhongjie")!=null){
request.getSession().removeAttribute("zhongjie");
}
}
/********************************************************
****************** 信息注销监听支持*****************************
*********************************************************/
public void delete() {
String id = request.getParameter("id");
DALBase.delete("huiyuan", " where id=" + id);
binding();
}
private void login() {
String usertype = request.getParameter("usertype");
if (usertype != null && usertype.equals("0")) {
huiyuanLogin();
}
}
private void huiyuanLogin() {
String accountname = request.getParameter("accountname");
String password = request.getParameter("password");
String filter = MessageFormat.format(
"where accountname=''{0}'' and password=''{1}''", accountname,
password);
Huiyuan huiyuan = (Huiyuan) DALBase.load("huiyuan", filter);
String errorurl=request.getParameter("errorurl");
String forwardurl=request.getParameter("forwardurl");
if (huiyuan != null && huiyuan.getPassword().equals(password)) {
try {
huiyuan.setLogtimes(huiyuan.getLogtimes() + 1);
DALBase.update(huiyuan);
request.getSession().setAttribute("huiyuan", huiyuan);
if (forwardurl != null)
response.sendRedirect(SystemParam.getSiteRoot()
+ forwardurl);
else {
response.sendRedirect(SystemParam.getSiteRoot() + "/e/huiyuan/accountinfo.jsp");
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else {
dispatchParams(request, response);
request.setAttribute("errormsg", "");
try {
request.getRequestDispatcher(errorurl).forward(request, response);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
/*************************************************************
**************** 保存动作监听支持******************************
**************************************************************/
public void save() {
String accountname = request.getParameter("accountname");
String password = request.getParameter("password");
String mobile=request.getParameter("mobile");
String email = request.getParameter("email");
if (DALBase.isExist("huiyuan", "where accountname='" + accountname
+ "'")) {
try {
request.setAttribute("errormsg",
"");
dispatchParams(request, response);
request.getRequestDispatcher("/e/register.jsp").forward(
request, response);
} catch (ServletException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return;
}
Huiyuan huiyuan = new Huiyuan();
huiyuan.setAccountname(accountname == null ? "" : accountname);
huiyuan.setPassword(password == null ? "" : password);
if(mobile!=null)
huiyuan.setMobile(mobile);
huiyuan.setNickname(accountname);
huiyuan.setRegdate(new Date());
huiyuan.setLogtimes(0);
huiyuan.setTouxiang(SystemParam.getSiteRoot()
+ "/upload/nopic.jpg");
huiyuan.setEmail(email == null ? "" : email);
huiyuan.setSex("男");
huiyuan.setAddress("");
huiyuan.setJibie("初级");
huiyuan.setName("");
huiyuan.setZhiye("");
huiyuan.setAihao("");
huiyuan.setStatus(1);
huiyuan.setYue(0);
huiyuan.setXtype("普通会员");
DALBase.save(huiyuan);
try {
response.sendRedirect("../e/regresult.jsp");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/******************************************************
*********************** 更新内部支持*********************
*******************************************************/
public void update() {
String id = request.getParameter("id");
if (id == null)
return;
Huiyuan huiyuan = (Huiyuan) DALBase
.load(Huiyuan.class, new Integer(id));
if (huiyuan == null)
return;
String accountname = request.getParameter("accountname");
String nickname = request.getParameter("nickname");
String forwardurl = request.getParameter("forwardurl");
String touxiang = request.getParameter("touxiang");
String email = request.getParameter("email");
String mobile = request.getParameter("mobile");
String sex = request.getParameter("sex");
String address = request.getParameter("address");
String jibie = request.getParameter("jibie");
String name = request.getParameter("name");
String zhiye = request.getParameter("zhiye");
String aihao = request.getParameter("aihao");
String status = request.getParameter("status");
SimpleDateFormat sdfhuiyuan = new SimpleDateFormat("yyyy-MM-dd");
huiyuan.setAccoun
资源文件列表:
校园失物招领系统.zip 大约有1479个文件