Package com.useractionsmodule.servlet

Source Code of com.useractionsmodule.servlet.TbUserActionsServlet

package com.useractionsmodule.servlet;
import com.useractionsmodule.bean.TbUserActions;
import com.useractionsmodule.dao.*;

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

public class TbUserActionsServlet 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)){
        String userActionName=request.getParameter("userActionName");
        String userActionMemo=request.getParameter("userActionMemo");
        String createTime=request.getParameter("createTime");

            if(new TbUserActionsDAO().add(new TbUserActions(userActionName,userActionMemo))){
            request.getSession().setAttribute("result", "添加成功");
            }else{           
            request.getSession().setAttribute("result", "添加失败");
            }
             request.getSession(true).setAttribute("tbUserActionsList",new TbUserActionsDAO().getTbUserActionsAll());
            response.sendRedirect("UseractionsModule/TbUserActionsList.jsp");
        }
        if("del".equals(method)){
            if(UtilDAO.delin("Tb_UserActions", "UserAction", request.getParameter("delIds"))){           
            request.getSession().setAttribute("result", "删除成功");
            }else{           
            request.getSession().setAttribute("result", "删除失败");
            }
             request.getSession(true).setAttribute("tbUserActionsList",new TbUserActionsDAO().getTbUserActionsAll());
            response.sendRedirect("UseractionsModule/TbUserActionsList.jsp");
        }
        if("edit".equals(method)){
        int userAction=Integer.parseInt(request.getParameter("userAction"));
        String userActionName=request.getParameter("userActionName");
        String userActionMemo=request.getParameter("userActionMemo");
        String createTime=request.getParameter("createTime");

            if(new TbUserActionsDAO().add(new TbUserActions(userAction,userActionName,userActionMemo))){
            request.getSession().setAttribute("result", "修改成功");
            }else{           
            request.getSession().setAttribute("result", "修改失败");
            }
             request.getSession(true).setAttribute("tbUserActionsList",new TbUserActionsDAO().getTbUserActionsAll());
            response.sendRedirect("UseractionsModule/TbUserActionsList.jsp");
        }
        if ("list".equals(method)) {
             request.getSession(true).setAttribute("tbUserActionsList",new TbUserActionsDAO().getTbUserActionsAll());
            response.sendRedirect("UseractionsModule/TbUserActionsList.jsp");
          }
        if ("listById".equals(method)) {
             request.getSession(true).setAttribute("tbUserActions",new TbUserActionsDAO().getTbUserActionsByUserAction(Integer.parseInt(request.getParameter("userAction"))));
            response.sendRedirect("UseractionsModule/TbUserActionsOperate.jsp");
      }
        if("showadd".equals(method)){
           
            response.sendRedirect("UseractionsModule/TbUserActionsOperate.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.useractionsmodule.servlet.TbUserActionsServlet

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.