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音像店租赁管理系统的设计与实现(源代码)
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共29个文件
java:21个
xml:3个
properties:2个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
需积分: 1 0 下载量 195 浏览量
2024-07-30
12:21:35
上传
评论
收藏 120KB ZIP 举报
温馨提示
随着信息技术在管理上的广泛应用,管理信息系统(MIS)的实施在技术上已经逐步成熟。企业要生存、要发展、要高效率地把企业活动有效组织起来,就必须加强对企业内部各种资源(人、财、物)的有效管理,建立与自身特点相适应的管理信息系统。 本音像店管理租赁管理系统,设计并且完成了一个小型的音像店管理信息系统,使得经营者以及普通用户能对影碟的历史记录等进行操作。 本音像店租赁管理系统是一个典型的管理信息系统,在J2EE架构的基础下实现模块化,使用Struts和Hibernate技术实现并完成。在该系统的设计和实现过程中,采用了一些新技术,使其具有了良好的扩展性以及最大程度上降低了耦合。
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/ZIP.png)
共 29 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
python资深爱好者
- 粉丝: 1535
- 资源: 2784
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)