String method = "";
if (request.getParameter("method") != null) {
method = request.getParameter("method");
}
if ("add".equals(method)) {
if(new TbRoleDAO().add(new TbRole(request.getParameter("roleName"),((TbUsers)request.getSession().getAttribute("User")).getUserId()))){
response.sendRedirect("UserModule/RoleList.jsp?addok=1");
}
}
if ("edit".equals(method)) {
if(new TbRoleDAO().edit(new TbRole(Integer.parseInt(request.getParameter("roleId")),request.getParameter("roleName")))){
response.sendRedirect("UserModule/RoleList.jsp?editok=1");
}
}