• 大小: 1.63MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-10-16
  • 语言: Java
  • 标签: jsp  struts  

资源简介

本系统采用jsp+struts+MySQL技术,有两类用户:管理者和用户,分为前台后台,前台负责公告管理,提供给所有用户使用,管理员还能撰写,修改,删除公告

资源截图

代码片段和文件信息

package nm;

import java.util.Vector;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.sql.DataSource;


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.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;

public final class CheckPowerAction extends Action {
public ActionForward execute(ActionMapping mapping ActionForm form
HttpServletRequest request HttpServletResponse response)
throws Exception {

String functiontype = request.getParameter(“functiontype“);

ServletContext context = servlet.getServletContext();
DataSource dataSource = (DataSource) context
.getAttribute(Constants.DATASOURCE_KEY);
DB db = new DB(dataSource);

HttpSession session = request.getSession();
ActionMessages errors = new ActionMessages();
String pageForward = “ToErrorPage“;
User loginuser = (User) session.getAttribute(Constants.LOGIN_USER_KEY);

if (functiontype.equals(“newuser“)) {
if (loginuser.getGrade().equals(“admin“)) {
pageForward = “ToNewUser“;
} else {
errors.add(ActionMessages.GLOBAL_MESSAGE new ActionMessage(
“error.power.newuser.notadmin“));
if (!errors.isEmpty()) {
// saveErrors(request errors);
this.saveMessages(request errors);
}
}
} else if (functiontype.equals(“useredit“)) {
if (loginuser.getGrade().equals(“admin“)) {
String username = request.getParameter(“username“);
User curUser = (User) User.search(db username).get(0);
session.setAttribute(Constants.CUR_USER_KEY curUser);
pageForward = “ToUserEdit“;
} else {
errors.add(ActionMessages.GLOBAL_MESSAGE new ActionMessage(
“error.power.edit.notadmin“));
if (!errors.isEmpty()) {
// saveErrors(request errors);
this.saveMessages(request errors);
}
}
} else if (functiontype.equals(“userdelete“)) {
if (loginuser.getGrade().equals(“admin“)) {
String username = request.getParameter(“username“);
if (User.delete(db username)) {
Vector users = new Vector();
users = User.search(db ““);
session.setAttribute(Constants.USER_LIST_KEY users);
pageForward = “ToUserList“;
} else {
errors.add(ActionMessages.GLOBAL_MESSAGE
new ActionMessage(“error.delete.failed“));
if (!errors.isEmpty()) {
// saveErrors(request errors);
this.saveMessages(request errors);
}
}
} else {
errors.add(ActionMessages.GLOBAL_MESSAGE new ActionMessage(
“error.power.delete.notadmin“));
if (!errors.isEmpty()) {
// saveErrors(request errors);
this.saveMessages(request errors);
}
}
} else if (functiontype.equals(“noticedelete“

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1272  2007-11-19 10:19  NoticeManager\.classpath

     文件        312  2007-11-19 10:19  NoticeManager\.mymetadata

     文件        242  2007-11-19 10:19  NoticeManager\.mystrutsdata

     文件       1314  2007-11-19 10:19  NoticeManager\.project

     文件       1667  2007-11-19 10:18  NoticeManager\noticemanager.sql

     文件       2093  2007-11-19 10:19  NoticeManager\src\nm\admin\action\AdminLoginAction.java

     文件        666  2007-11-19 10:19  NoticeManager\src\nm\admin\action\AdminLogoffAction.java

     文件       2276  2007-11-19 10:19  NoticeManager\src\nm\admin\action\NewUserAction.java

     文件       2318  2007-11-19 10:19  NoticeManager\src\nm\admin\action\UserEditAction.java

     文件       1763  2007-11-19 10:19  NoticeManager\src\nm\admin\action\UserSearchAction.java

     文件        611  2007-11-19 10:19  NoticeManager\src\nm\admin\form\AdminLoginForm.java

     文件       1354  2007-11-19 10:19  NoticeManager\src\nm\admin\form\UserInfoForm.java

     文件         76  2007-11-19 10:19  NoticeManager\src\nm\ApplicationResources.properties

     文件       4316  2007-11-19 10:19  NoticeManager\src\nm\ApplicationResources_zh.properties

     文件       4305  2007-11-19 10:19  NoticeManager\src\nm\CheckPowerAction.java

     文件        313  2007-11-19 10:19  NoticeManager\src\nm\Constants.java

     文件       1450  2007-11-19 10:19  NoticeManager\src\nm\DB.java

     文件       3149  2007-11-19 10:19  NoticeManager\src\nm\DBUtil.java

     文件       4031  2007-11-19 10:19  NoticeManager\src\nm\Notice.java

     文件       5142  2007-11-19 10:19  NoticeManager\src\nm\Pageable.java

     文件       2799  2007-11-19 10:19  NoticeManager\src\nm\tag\DisplayTag.java

     文件       1137  2007-11-19 10:19  NoticeManager\src\nm\tag\HelloTag.java

     文件       1528  2007-11-19 10:19  NoticeManager\src\nm\user\action\NewNoticeAction.java

     文件       1613  2007-11-19 10:19  NoticeManager\src\nm\user\action\NoticeModifyAction.java

     文件       1862  2007-11-19 10:19  NoticeManager\src\nm\user\action\UserLoginAction.java

     文件        663  2007-11-19 10:19  NoticeManager\src\nm\user\action\UserLogoffAction.java

     文件       1488  2007-11-19 10:19  NoticeManager\src\nm\user\form\NewNoticeForm.java

     文件       1476  2007-11-19 10:19  NoticeManager\src\nm\user\form\NoticeModifyForm.java

     文件        608  2007-11-19 10:19  NoticeManager\src\nm\user\form\UserLoginForm.java

     文件       4830  2007-11-19 10:19  NoticeManager\src\nm\User.java

............此处省略121个文件信息

评论

共有 条评论