String roleName=request.getParameter("roleName");
int userId=Integer.parseInt(request.getParameter("userId"));
String roleMemo=request.getParameter("roleMemo");
String createTime=request.getParameter("createTime");
if(new TbRoleDAO().add(new TbRole(roleName,userId,roleMemo,createTime))){
request.getSession().setAttribute("result", "添加成功");
}else{
request.getSession().setAttribute("result", "添加失败");
}
request.getSession(true).setAttribute("tbRoleList",new TbRoleDAO().getTbRoleAll());
response.sendRedirect("RoleModule/TbRoleList.jsp");
}
if("del".equals(method)){
if(UtilDAO.delin("Tb_Role", "RoleId", request.getParameter("delIds"))){
request.getSession().setAttribute("result", "删除成功");
}else{
request.getSession().setAttribute("result", "删除失败");
}
request.getSession(true).setAttribute("tbRoleList",new TbRoleDAO().getTbRoleAll());
response.sendRedirect("RoleModule/TbRoleList.jsp");
}
if("edit".equals(method)){
int roleId=Integer.parseInt(request.getParameter("roleId"));
String roleName=request.getParameter("roleName");
int userId=Integer.parseInt(request.getParameter("userId"));
String roleMemo=request.getParameter("roleMemo");
String createTime=request.getParameter("createTime");
if(new TbRoleDAO().add(new TbRole(roleId,roleName,userId,roleMemo,createTime))){
request.getSession().setAttribute("result", "修改成功");
}else{
request.getSession().setAttribute("result", "修改失败");
}
request.getSession(true).setAttribute("tbRoleList",new TbRoleDAO().getTbRoleAll());