Package com.rolemodulemiddlemodule.servlet

Source Code of com.rolemodulemiddlemodule.servlet.TbRoleModuleMiddleServlet

package com.rolemodulemiddlemodule.servlet;
import com.rolemodulemiddlemodule.bean.TbRoleModuleMiddle;
import com.rolemodulemiddlemodule.dao.*;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import util.*;

public class TbRoleModuleMiddleServlet extends HttpServlet{
    public void processRequest(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
        String method = request.getParameter("method")==null?"":request.getParameter("method");
        if("add".equals(method)){
        int roleId=Integer.parseInt(request.getParameter("roleId"));
        int moduleId=Integer.parseInt(request.getParameter("moduleId"));
        int userAction=Integer.parseInt(request.getParameter("userAction"));
        String createTime=request.getParameter("createTime");

            if(new TbRoleModuleMiddleDAO().add(new TbRoleModuleMiddle(roleId,moduleId,userAction,createTime))){
            request.getSession().setAttribute("result", "添加成功");
            }else{           
            request.getSession().setAttribute("result", "添加失败");
            }
             request.getSession(true).setAttribute("tbRoleModuleMiddleList",new TbRoleModuleMiddleDAO().getTbRoleModuleMiddleAll());
            response.sendRedirect("RolemodulemiddleModule/TbRoleModuleMiddleList.jsp");
        }
        if("del".equals(method)){
            if(UtilDAO.delin("Tb_RoleModuleMiddle", "RoleModuleMiddleId", request.getParameter("delIds"))){           
            request.getSession().setAttribute("result", "删除成功");
            }else{           
            request.getSession().setAttribute("result", "删除失败");
            }
             request.getSession(true).setAttribute("tbRoleModuleMiddleList",new TbRoleModuleMiddleDAO().getTbRoleModuleMiddleAll());
            response.sendRedirect("RolemodulemiddleModule/TbRoleModuleMiddleList.jsp");
        }
        if("edit".equals(method)){
        int roleModuleMiddleId=Integer.parseInt(request.getParameter("roleModuleMiddleId"));
        int roleId=Integer.parseInt(request.getParameter("roleId"));
        int moduleId=Integer.parseInt(request.getParameter("moduleId"));
        int userAction=Integer.parseInt(request.getParameter("userAction"));
        String createTime=request.getParameter("createTime");

            if(new TbRoleModuleMiddleDAO().add(new TbRoleModuleMiddle(roleModuleMiddleId,roleId,moduleId,userAction,createTime))){
            request.getSession().setAttribute("result", "修改成功");
            }else{           
            request.getSession().setAttribute("result", "修改失败");
            }
             request.getSession(true).setAttribute("tbRoleModuleMiddleList",new TbRoleModuleMiddleDAO().getTbRoleModuleMiddleAll());
            response.sendRedirect("RolemodulemiddleModule/TbRoleModuleMiddleList.jsp");
        }
        if ("list".equals(method)) {
             request.getSession(true).setAttribute("tbRoleModuleMiddleList",new TbRoleModuleMiddleDAO().getTbRoleModuleMiddleAll());
            response.sendRedirect("RolemodulemiddleModule/TbRoleModuleMiddleList.jsp");
          }
        if ("listById".equals(method)) {
             request.getSession(true).setAttribute("tbRoleModuleMiddle",new TbRoleModuleMiddleDAO().getTbRoleModuleMiddleByRoleModuleMiddleId(Integer.parseInt(request.getParameter("roleModuleMiddleId"))));
            response.sendRedirect("RolemodulemiddleModule/TbRoleModuleMiddleOperate.jsp");
      }
        if("showadd".equals(method)){
           
            response.sendRedirect("RolemodulemiddleModule/TbRoleModuleMiddleOperate.jsp");
        }
    }
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.processRequest(request, response);
    }// end method doGet
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.processRequest(request, response);
    }// end method doPost
}
TOP

Related Classes of com.rolemodulemiddlemodule.servlet.TbRoleModuleMiddleServlet

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.