package com.wilson.struts;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;
import com.wilson.service.admin.AdminService;
import com.wilson.service.user.UserService;
import com.wilson.util.ObjectFactory;
import com.wilson.vo.DVD;
import com.wilson.vo.User;
public class AdminAction extends DispatchAction {
private UserService us = (UserService) ObjectFactory
.createObject(UserService.class);
private AdminService as = (AdminService) ObjectFactory
.createObject(AdminService.class);
private List<User> userlist = null;
private List<DVD> dvdlist = null;
@SuppressWarnings("deprecation")
public ActionForward adminLogin(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String adminname = request.getParameter("adminname");
String adminpassword = request.getParameter("adminpassword");
if (adminname.equals("admin") && adminpassword.equals("password")) {
return mapping.findForward("adminmain");
} else {
ActionErrors aes = new ActionErrors();
aes.add("adminname.adminpassword.error", new ActionError(
"adminname.adminpassword.error"));
saveErrors(request, aes);
return mapping.findForward("adminlogin");
}
}
@SuppressWarnings( { "unchecked", "deprecation" })
public ActionForward userList(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
userlist = us.showAll();
HttpSession session = request.getSession();
session.setAttribute("userlist", userlist);
return mapping.findForward("userlist");
} catch (Exception e) {
e.printStackTrace();
ActionErrors aes = new ActionErrors();
aes.add("adminuserlist.notfound.error", new ActionError(
"adminuserlist.notfound.error"));
saveErrors(request, aes);
return mapping.findForward("adminmain");
}
}
// 删除用户
@SuppressWarnings( { "unchecked", "deprecation" })
public ActionForward deleteUser(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
Integer userid = Integer.parseInt(request.getParameter("userid"));
try {
userlist = as.delUserById(userid);
HttpSession session = request.getSession();
session.setAttribute("userlist", userlist);
return mapping.findForward("userlist");
} catch (Exception e) {
e.printStackTrace();
ActionErrors aes = new ActionErrors();
aes.add("adminuserdelete.error", new ActionError(e.getMessage()));
saveErrors(request, aes);
return mapping.findForward("userlist");
}
}
// 得到所有DVD
@SuppressWarnings( { "unchecked", "deprecation" })
public ActionForward showAll(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
String funcType = request.getParameter("funcType");
try {
dvdlist = as.getAllDvd();
HttpSession session = request.getSession();
session.setAttribute("dvdlist", dvdlist);
return mapping.findForward("admindvdlist");
} catch (Exception e) {
e.printStackTrace();
ActionErrors aes = new ActionErrors();
aes.add("admindvdlist.null", new ActionError(e.getMessage()));
saveErrors(request, aes);
return mapping.findForward("admindvdlist");
}
}
// 删除DVD
@SuppressWarnings("deprecation")
public ActionForward deleteDVD(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
Integer dvdid = Integer.parseInt(request.getParameter("dvdid"));
try {
dvdlist = as.delDvdById(dvdid);
HttpSession session = request.getSession();
session.setAttribute("dvdlist", dvdlist);
return mapping.findForward("admindvdlist");
} catch (Exception e) {
e.printStackTrace();
ActionErrors aes = new ActionErrors();
aes.add("admindvd.delete.error", new ActionError(e.getMessage()));
saveErrors(request, aes);
return mapping.findForward("admindvdlist");
}
}
@SuppressWarnings( { "deprecation", "deprecation" })
public ActionForward add(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
DvdForm df = (DvdForm) form;
try {
String dvdname = df.getDvdname();
String state = df.getState();
df.setDvdname(new String(dvdname.getBytes("ISO-8859-1"), "gbk"));
df.setState(new String(state.getBytes("ISO-8859-1"), "gbk"));
dvdlist = as.addDvd(df);
HttpSession session = request.getSession();
session.setAttribute("dvdlist", dvdlist);
return mapping.findForward("admindvdlist");
} catch (Exception e) {
e.printStackTrace();
ActionErrors aes = new ActionErrors();
aes.add("admindvd.add.error", new ActionError(e.getMessage()));
saveErrors(request, aes);
return mapping.findForward("adminadddvd");
}
}
// 得到页面上的修改后信息,并且保存
public ActionForward edit(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
DvdForm df = (DvdForm) form;
try {
String dvdname = df.getDvdname();
String state = df.getState();
df.setDvdname(new String(dvdname.getBytes("ISO-8859-1"), "gbk"));
df.setState(new String(state.getBytes("ISO-8859-1"), "gbk"));
dvdlist = as.editDvd(df);
HttpSession session = request.getSession();
session.setAttribute("dvdlist", dvdlist);
return mapping.findForward("admindvdlist");
} catch (Exception e) {
e.printStackTrace();
ActionErrors aes = new ActionErrors();
aes.add("admindvd.edit.error", new ActionError(e.getMessage()));
saveErrors(request, aes);
return mapping.findForward("admindvdlist");
}
}
// 得到一个影碟信息
public ActionForward getOne(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
Integer dvdid = Integer.parseInt(request.getParameter("dvdid"));
String funcType = request.getParameter("functype");
try {
DVD dvd = as.getById(dvdid);
HttpSession session = request.getSession();
session.setAttribute("findDVD", dvd);
// 如果是查找影碟信息,则把查询信息存入会话中并且转向查询结果页面
if (funcType.equals("findone")) {
return mapping.findForward("adminfinddvd");
}
// 如果要在查询结果页面中对影碟信息进行编辑,则找到该影碟信息后转向编辑页面
if (funcType.equals("fromfind")) {
return mapping.findForward("admineditdvd");
}
// 如果在影碟列表页面中对影碟信息进行编辑,则找到该影碟信息后转向编辑页面
if (funcType.equals("fromlist")) {
return mapping.findForward("admineditdvd");
}
return mapping.findForward("admindvdlist");
} catch (Exception e) {
e.printStackTrace();
ActionErrors aes = new ActionErrors();
aes.add("admin.getone.error", new ActionError(e.getMessage()));
saveErrors(request, aes);
return mapping.findForward("admindvdlist");
}
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
JAVA音像店租赁管理系统的设计与实现(源代码)
共29个文件
java:21个
xml:3个
properties:2个
需积分: 1 0 下载量 28 浏览量
2024-07-30
12:21:35
上传
评论
收藏 120KB ZIP 举报
温馨提示
随着信息技术在管理上的广泛应用,管理信息系统(MIS)的实施在技术上已经逐步成熟。企业要生存、要发展、要高效率地把企业活动有效组织起来,就必须加强对企业内部各种资源(人、财、物)的有效管理,建立与自身特点相适应的管理信息系统。 本音像店管理租赁管理系统,设计并且完成了一个小型的音像店管理信息系统,使得经营者以及普通用户能对影碟的历史记录等进行操作。 本音像店租赁管理系统是一个典型的管理信息系统,在J2EE架构的基础下实现模块化,使用Struts和Hibernate技术实现并完成。在该系统的设计和实现过程中,采用了一些新技术,使其具有了良好的扩展性以及最大程度上降低了耦合。
资源推荐
资源详情
资源评论
收起资源包目录
JAVA音像店租赁管理系统的设计与实现(源代码).zip (29个子文件)
JAVA音像店租赁管理系统的设计与实现(源代码)
毕业设计代码
hibernate.cfg.xml 1KB
com
wilson
struts
ApplicationResources.properties 911B
UserForm.java 2KB
UserLoginForm.java 1KB
DvdForm.java 576B
AdminAction.java 7KB
UserLoginAction.java 1KB
UserAction.java 5KB
UserInforForm.java 2KB
service
admin
AdminService.java 531B
AdminServiceImpl.java 4KB
readme 0B
user
UserService.java 679B
UserServiceImpl.java 5KB
hibernate
readme 0B
user
user.hbm.xml 699B
UserDAOImpl.java 2KB
UserDAO.java 645B
Test.java 710B
dvd
TestHibernate.java 2KB
DvdDAO.java 597B
dvd.hbm.xml 438B
DvdDAOImpl.java 2KB
util
interfaceclass.properties 300B
SessionFactory.java 670B
ObjectFactory.java 932B
vo
DVD.java 502B
User.java 906B
项目说明.zip 87KB
共 29 条
- 1
资源评论
python资深爱好者
- 粉丝: 2054
- 资源: 2784
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 2023-04-06-项目笔记 - 第三百三十五阶段 - 4.4.2.333全局变量的作用域-333 -2025.12.02
- GTK3 的 Go 绑定.zip
- GTK 的 Go 绑定.zip
- GraphQL 的 Go,Golang 实现.zip
- Go(golang)游戏服务器框架.zip
- ASP.NET C#+JS多文件上传源码
- Go(golang)中的 JavaScript 解释器.zip
- goth 包提供了一种简单、干净且惯用的方式来为 Go Web 应用程序编写身份验证包 .zip
- PHP 中 Cookie 和 Session 的使用简易教程(学习笔记)
- SoftEther VPN Client + VPN Gate Client 插件
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功