package com.ssit.Servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.sql.ResultSet;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.ssit.DB.DB_Handle;
import com.ssit.Handle.String_Handle;
/**
* 中科盛世
* 创建日期: Dec 10, 200710:43:01 AM
* 外层包:com.ssit.Servlet
* @author 易纲
*/
public class UserGroupInfo extends HttpServlet {
/**
* Constructor of the object.
*/
public UserGroupInfo() {
super();
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request, response);
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String actionType = request.getParameter("actionType");
if (actionType.equals("del")) {
doDel(request, response);
} else if (actionType.equals("new")) {
try {
doNew(request, response);
} catch (SQLException e) {
e.getStackTrace();
}
} else if (actionType.equals("update")) {
doUpdate(request, response);
}
}
/**
* 返回权限编号
* @param SECURITY_NAME 权限名称
* @return
*/
String getSecurityId(String SECURITY_NAME) throws SQLException {
String securityId = "";
DB_Handle dbHandle = new DB_Handle();
dbHandle.connectionDatabase();
ResultSet rs = dbHandle
.execQuerySQL("select * from privilegetable where priv= '"
+ SECURITY_NAME + "'");
if (rs.next()) {
securityId = rs.getString("id");
}
dbHandle.freeConnection();
return securityId;
}
void doNew(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException {
ResultSet rs;
String ID;
String userGroupName = String_Handle.unescape_GB2312(request
.getParameter("userGroupName"));
String admin = request.getParameter("admin");
String isAuditing = request.getParameter("isAuditing");
String expert_new = request.getParameter("expert_new");
String expert_update = request.getParameter("expert_update");
String expert_del = request.getParameter("expert_del");
String project_new = request.getParameter("project_new");
String project_update = request.getParameter("project_update");
String project_del = request.getParameter("project_del");
String expert_query = request.getParameter("expert_query");
String expert_auditing = request.getParameter("expert_auditing");
DB_Handle dbHandle = new DB_Handle();
dbHandle.connectionDatabase();
rs = dbHandle
.execQuerySQL("select * from usergroup where groupname = '"
+ userGroupName + "'");
if (rs.next()) {
dbHandle.freeConnection();
response.sendRedirect("../SystemSet/UserGroupManage/warning.jsp");
} else {
ID = String_Handle.getCurrDateTimeStr(false, true);
dbHandle
.execUpdateSQL("insert into usergroup(id,groupname)values('"
+ ID
+ "','" + userGroupName + "')");
if ((admin!=null) && admin.equals("1")) {
dbHandle.execUpdateSQL("insert into role(groupid,privid)values('" + ID + "'," + getSecurityId("系统管理") + ")");
}
if ((isAuditing!=null) && isAuditing.equals("1")) {
dbHandle.execUpdateSQL("insert into role(groupid,privid)values('" + ID + "'," + getSecurityId("用户审核") + ")");
}
if ((expert_new!=null) && expert_new.equals("1")) {
dbHandle.execUpdateSQL("insert into role(groupid,privid)values('" + ID + "'," + getSecurityId("专家新增") + ")");
}
if ((expert_update!=null) && expert_update.equals("1")) {
dbHandle.execUpdateSQL("insert into role(groupid,privid)values('" + ID + "'," + getSecurityId("专家修改") + ")");
}
if ((expert_del!=null) && expert_del.equals("1")) {
dbHandle.execUpdateSQL("insert into role(groupid,privid)values('" + ID + "'," + getSecurityId("专家删除") + ")");
}
if ((project_new!=null) && project_new.equals("1")) {
dbHandle.execUpdateSQL("insert into role(groupid,privid)values('" + ID + "'," + getSecurityId("项目新增") + ")");
}
if ((project_update!=null) && project_update.equals("1")) {
dbHandle.execUpdateSQL("insert into role(groupid,privid)values('" + ID + "'," + getSecurityId("项目修改") + ")");
}
if ((project_del!=null) && project_del.equals("1")) {
dbHandle.execUpdateSQL("insert into role(groupid,privid)values('" + ID + "'," + getSecurityId("项目删除") + ")");
}
if ((expert_query!=null) && expert_query.equals("1")) {
dbHandle.execUpdateSQL("insert into role(groupid,privid)values('" + ID + "'," + getSecurityId("专家抽取") + ")");
}
if ((expert_auditing!=null) && expert_auditing.equals("1")) {
dbHandle.execUpdateSQL("insert into role(groupid,privid)values('" + ID + "'," + getSecurityId("专家评审") + ")");
}
dbHandle.freeConnection();
response.sendRedirect("../SystemSet/UserGroupManage/index.jsp");
}
}
void doDel(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String[] s = request.getParameterValues("delID");
DB_Handle dbHandle = new DB_Handle();
dbHandle.connectionDatabase();
for (int i = 0; i < s.length; i++) {
dbHandle.execUpdateSQL("delete from usergroup where id = "
+ s[i]);
}
dbHandle.freeConnection();
response.sendRedirect("../SystemSet/UserGroupManage/index.jsp");
}
void doUpdate(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String id = request.getParameter("id");
String userName = String_Handle.unescape_GB2312(request
.getParameter("userName"));
DB_Handle dbHandle = new DB_Handle();
dbHandle.connectionDatabase();
dbHandle.execUpdateSQL("update usergroup set groupname = '" + userName+
"' where id = " + id);
dbHandle.freeConnection();
response.sendRedirect("../SystemSet/UserGroupManage/index.jsp");
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
MyEclipse 6.0开发实例
共112个文件
jsp:57个
png:14个
class:8个
需积分: 0 20 下载量 67 浏览量
2008-10-28
16:32:38
上传
评论
收藏 119KB ZIP 举报
温馨提示
主要采MyEclipse 6.0开发,sql2000数据库,jsp+servlet供初学者学习。
资源推荐
资源详情
资源评论
收起资源包目录
MyEclipse 6.0开发实例 (112个子文件)
UserGroupInfo.class 5KB
ExpertInfo.class 5KB
UserInfo.class 4KB
DdInfo.class 4KB
ItemInfo.class 4KB
DB_Handle.class 3KB
String_Handle.class 3KB
ExpertExtraction.class 2KB
.classpath 340B
.classpath 340B
xtree2.css 2KB
commonPage.css 63B
Thumbs.db 26KB
loading.gif 825B
exclamation.16.gif 262B
plus.gif 153B
minus.gif 150B
index.html 869B
Desktop_.ini 10B
Desktop_.ini 10B
UserGroupInfo.java 7KB
ExpertInfo.java 7KB
UserInfo.java 5KB
DdInfo.java 5KB
ItemInfo.java 5KB
ExpertExtraction.java 3KB
DB_Handle.java 2KB
String_Handle.java 2KB
xtree2.js 33KB
ddManage_Menu.js 826B
userManage_Menu.js 779B
expertsyndicManage_Menu.js 506B
expertManage_Menu.js 502B
itemManage_Menu.js 479B
common.js 315B
index.jsp 6KB
update.jsp 6KB
select.jsp 6KB
new.jsp 5KB
selectresult.jsp 5KB
selectresult1.jsp 4KB
index.jsp 4KB
itemInfo.jsp 4KB
schedule.jsp 4KB
info.jsp 4KB
update.jsp 4KB
index.jsp 3KB
lookup.jsp 3KB
index.jsp 3KB
expertgrade.jsp 3KB
new.jsp 3KB
new.jsp 3KB
update.jsp 3KB
new.jsp 3KB
expertregistrationinfo.jsp 3KB
auditresult.jsp 3KB
finish.jsp 3KB
itemexpertinfo.jsp 3KB
lookup.jsp 2KB
allexpertgrade.jsp 2KB
updata.jsp 2KB
experttoappraisal.jsp 2KB
lookup.jsp 2KB
info.jsp 2KB
updatescheduleresult.jsp 2KB
info.jsp 2KB
updata.jsp 2KB
expertregistration.jsp 2KB
updateschedule.jsp 2KB
new.jsp 2KB
info.jsp 2KB
info.jsp 2KB
lookup.jsp 2KB
checkUser.jsp 2KB
audit.jsp 2KB
login.jsp 2KB
expertinto.jsp 1KB
checkaudit.jsp 1KB
checkaudit.jsp 1KB
leftFrame.jsp 1KB
index.jsp 1KB
index.jsp 869B
checkLogin.jsp 796B
topFrame.jsp 569B
warning.jsp 569B
warning.jsp 485B
warning.jsp 482B
warning.jsp 481B
warning.jsp 472B
warning.jsp 472B
mainFrame.jsp 458B
warning.jsp 434B
MANIFEST.MF 39B
.mymetadata 309B
.mymetadata 291B
exclamation.16.png 788B
openfolder.png 449B
file.png 377B
folder.png 369B
Lplus.png 348B
共 112 条
- 1
- 2
资源评论
XMMXBB
- 粉丝: 1
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于Android的学生信息管理2.rar
- 3e9ef566-ba13-47b0-a252-77aa9e4b040f8412130.apk
- 毕业设计基于SSM的房屋租赁系统源【源码+lw+部署+讲解】
- 基于Android男装出口管理系统的app.rar
- 工资表生成工资条Excel模版
- 位运算、状态压缩、枚举子集汇总.html
- C++毕业设计快递分拣机器人系统源码+论文文件+资料.zip
- 锐龙处理器 体质分析工具,体质越好越稳定,越容易超频 tool1007/Win V/F
- IOS Swift3 四种单例模式详解及实例《PPT文档》
- Swin-Unet网络预训练模型,swin-tiny-patch-window7-224.pth
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功