AdminInsert.java
上传用户:quasar007
上传日期:2022-08-11
资源大小:4067k
文件大小:1k
源码类别:

企业管理

开发平台:

Java

  1. package com.webtier.manager;
  2. import org.apache.struts.action.ActionMapping;
  3. import org.apache.struts.action.ActionForm;
  4. import javax.servlet.http.HttpServletRequest;
  5. import javax.servlet.http.HttpServletResponse;
  6. import org.apache.struts.action.ActionForward;
  7. import com.domain.UserForm;
  8. import org.apache.struts.action.Action;
  9. import com.service.UserFacade;
  10. import com.service.UserFacadeImpl;
  11. //添加管理员
  12. public class AdminInsert
  13.     extends Action {
  14.   private UserFacade facade = null;
  15.   public AdminInsert() {
  16.     this.facade = new UserFacadeImpl();
  17.   }
  18.   public ActionForward perform(ActionMapping actionMapping,
  19.                                ActionForm actionForm,
  20.                                HttpServletRequest servletRequest,
  21.                                HttpServletResponse servletResponse) {
  22.     UserForm userForm = (UserForm) actionForm;
  23.     userForm.setUser_name(servletRequest.getParameter("name"));
  24.     UserForm form = facade.checkUser(userForm);
  25.     if (form == null) {
  26.       userForm.setUser_id(servletRequest.getParameter("id"));
  27.       userForm.setUser_mm(servletRequest.getParameter("mm"));
  28.       this.facade.insertUser(userForm);
  29.       return actionMapping.findForward("insertRight");
  30.     }
  31.     else {
  32.       return actionMapping.findForward("insertWrong");
  33.     }
  34.   }
  35. }