Package org.apache.struts.action

Examples of org.apache.struts.action.ActionMessages$ActionMessageItem


  protected ActionForward doUpdateEmail(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    UserForm user = (UserForm) form;
    super.validateClientId(request, user);
    ActionMessages msgs = new ActionMessages();
   
    while (msgs.isEmpty()) {
      UserBean loginUser = super.getLoginUser(request, response);
      if(loginUser == null) {
        msgs.add("user", new ActionMessage("error.user_not_login"));
        break;
      }
      if(loginUser.getId() != user.getId()){
        msgs.add("user", new ActionMessage("error.access_deny"));
        break;
      }
      UserBean ubean = UserDAO.getUserByID(user.getId());
      if (ubean == null || ubean.getStatus()!=UserBean.STATUS_NORMAL) {
        msgs.add("id", new ActionMessage("error.user_not_available",
            new Integer(user.getId())));
        break;
      }
      if (!StringUtils.equals(ubean.getPassword(), user
          .getPassword())){
        msgs.add("password",
            new ActionMessage("error.user_auth_failed"));
        break;
      }
      ubean.setEmail(user.getEmail());
      try {
        DLOGUserManager.update(ubean);
        //����session�е��û�����
        UserLoginManager.updateLoginUser(request, ubean);   
      } catch (Exception e) {
        msgs.add("result", new ActionMessage("error.database", e
            .getMessage()));
      }
      break;
    }

    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("edituser");
    }

    StringBuffer ext = new StringBuffer();
View Full Code Here


  protected ActionForward doUpdateSex(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    UserForm user = (UserForm) form;
    super.validateClientId(request, user);
    ActionMessages msgs = new ActionMessages();
   
    while (msgs.isEmpty()) {
      UserBean loginUser = super.getLoginUser(request, response);
      if(loginUser == null) {
        msgs.add("user", new ActionMessage("error.user_not_login"));
        break;
      }
      if(loginUser.getId() != user.getId()){
        msgs.add("user", new ActionMessage("error.access_deny"));
        break;
      }
      UserBean ubean = UserDAO.getUserByID(user.getId());
      if (ubean == null || ubean.getStatus()!=UserBean.STATUS_NORMAL) {
        msgs.add("id", new ActionMessage("error.user_not_available",
            new Integer(user.getId())));
        break;
      }
      if (!StringUtils.equals(ubean.getPassword(), user
          .getPassword())){
        msgs.add("password",
            new ActionMessage("error.user_auth_failed"));
        break;
      }
      if (ubean.getSex() != user.getSex()) {
        if (user.getSex() == UserBean.SEX_FEMALE
            || user.getSex() == UserBean.SEX_MALE
            || user.getSex() == UserBean.SEX_UNKNOWN) {
          ubean.setSex(user.getSex());
          try {
            DLOGUserManager.update(ubean);
            // ����session�е��û�����
            UserLoginManager.updateLoginUser(request, ubean);
          } catch (Exception e) {
            msgs.add("result", new ActionMessage("error.database",
                e.getMessage()));
          }
        }
      }
      break;
    }

    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("edituser");
    }

    StringBuffer ext = new StringBuffer();
View Full Code Here

  protected ActionForward doUpdatePwd(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    UserForm user = (UserForm) form;
    super.validateClientId(request, user);
    ActionMessages msgs = new ActionMessages();
   
    while (msgs.isEmpty()) {
      UserBean loginUser = super.getLoginUser(request, response);
      if(loginUser == null) {
        msgs.add("user", new ActionMessage("error.user_not_login"));
        break;
      }
      if(loginUser.getId() != user.getId()){
        msgs.add("user", new ActionMessage("error.access_deny"));
        break;
      }
      UserBean ubean = UserDAO.getUserByID(user.getId());
      if (ubean == null || ubean.getStatus()!=UserBean.STATUS_NORMAL) {
        msgs.add("id", new ActionMessage("error.user_not_available",
            new Integer(user.getId())));
        break;
      }
      if (!StringUtils.equals(ubean.getPassword(), user
          .getPassword())){
        msgs.add("password",
            new ActionMessage("error.user_auth_failed"));
        break;
      }
      if(!StringUtils.equals(user.getPassword2(), ubean.getPassword())){
        ubean.setPassword(user.getPassword2());
        try {
          DLOGUserManager.update(ubean);
          //����session�е��û�����
          UserLoginManager.updateLoginUser(request, ubean);   
        } catch (Exception e) {
          msgs.add("result", new ActionMessage("error.database", e
              .getMessage()));
        }
      }
      break;
    }

    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("edituser");
    }

    StringBuffer ext = new StringBuffer();
View Full Code Here

  protected ActionForward doUpdateResume(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    UserForm user = (UserForm) form;
    super.validateClientId(request, user);
    ActionMessages msgs = new ActionMessages();
   
    while (msgs.isEmpty()) {
      UserBean loginUser = super.getLoginUser(request, response);
      if(loginUser == null) {
        msgs.add("user", new ActionMessage("error.user_not_login"));
        break;
      }
      if(loginUser.getId() != user.getId()){
        msgs.add("user", new ActionMessage("error.access_deny"));
        break;
      }
      UserBean ubean = UserDAO.getUserByID(user.getId());
      if (ubean == null || ubean.getStatus()!=UserBean.STATUS_NORMAL) {
        msgs.add("id", new ActionMessage("error.user_not_available",
            new Integer(user.getId())));
        break;
      }
      if (!StringUtils.equals(ubean.getPassword(), user
          .getPassword())){
        msgs.add("password",
            new ActionMessage("error.user_auth_failed"));
        break;
      }
      if(!StringUtils.equals(user.getResume(), ubean.getResume())){
        String resume = super.autoFiltrate(null, StringUtils.extractText(user.getResume()));
        ubean.setResume(resume);
        try {
          DLOGUserManager.update(ubean);
          //����session�е��û�����
          UserLoginManager.updateLoginUser(request, ubean);   
        } catch (Exception e) {
          msgs.add("result", new ActionMessage("error.database", e
              .getMessage()));
        }
      }
      break;
    }

    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("edituser");
    }

    StringBuffer ext = new StringBuffer();
View Full Code Here

  protected ActionForward doUpdateMSN(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    UserForm user = (UserForm) form;
    super.validateClientId(request, user);
    ActionMessages msgs = new ActionMessages();
   
    while (msgs.isEmpty()) {
      UserBean loginUser = super.getLoginUser(request, response);
      if(loginUser == null) {
        msgs.add("user", new ActionMessage("error.user_not_login"));
        break;
      }
      if(loginUser.getId() != user.getId()){
        msgs.add("user", new ActionMessage("error.access_deny"));
        break;
      }
      UserBean ubean = UserDAO.getUserByID(user.getId());
      if (ubean == null || ubean.getStatus()!=UserBean.STATUS_NORMAL) {
        msgs.add("id", new ActionMessage("error.user_not_available",
            new Integer(user.getId())));
        break;
      }
      if (!StringUtils.equals(ubean.getPassword(), user
          .getPassword())){
        msgs.add("password",
            new ActionMessage("error.user_auth_failed"));
        break;
      }
      if(!StringUtils.equals(user.getMsn(), ubean.getMsn())){
        ubean.setMsn(user.getMsn());
        try {
          DLOGUserManager.update(ubean);
          //����session�е��û�����
          UserLoginManager.updateLoginUser(request, ubean);   
        } catch (Exception e) {
          msgs.add("result", new ActionMessage("error.database", e
              .getMessage()));
        }
      }
      break;
    }

    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("edituser");
    }

    StringBuffer ext = new StringBuffer();
View Full Code Here

  protected ActionForward doUpdateHomePage(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    UserForm user = (UserForm) form;
    super.validateClientId(request, user);
    ActionMessages msgs = new ActionMessages();
   
    while (msgs.isEmpty()) {
      UserBean loginUser = super.getLoginUser(request, response);
      if(loginUser == null) {
        msgs.add("user", new ActionMessage("error.user_not_login"));
        break;
      }
      if(loginUser.getId() != user.getId()){
        msgs.add("user", new ActionMessage("error.access_deny"));
        break;
      }
      UserBean ubean = UserDAO.getUserByID(user.getId());
      if (ubean == null || ubean.getStatus()!=UserBean.STATUS_NORMAL) {
        msgs.add("id", new ActionMessage("error.user_not_available",
            new Integer(user.getId())));
        break;
      }
      if (!StringUtils.equals(ubean.getPassword(), user
          .getPassword())){
        msgs.add("password",
            new ActionMessage("error.user_auth_failed"));
        break;
      }
      if(!StringUtils.equals(user.getHomePage(), ubean.getHomePage())){
        ubean.setHomePage(user.getHomePage());
        try {
          DLOGUserManager.update(ubean);
          //����session�е��û�����
          UserLoginManager.updateLoginUser(request, ubean);   
        } catch (Exception e) {
          msgs.add("result", new ActionMessage("error.database", e
              .getMessage()));
        }
      }
      break;
    }

    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("edituser");
    }

    StringBuffer ext = new StringBuffer();
View Full Code Here

  protected ActionForward doUpdateQQ(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    UserForm user = (UserForm) form;
    super.validateClientId(request, user);
    ActionMessages msgs = new ActionMessages();
   
    while (msgs.isEmpty()) {
      UserBean loginUser = super.getLoginUser(request, response);
      if(loginUser == null) {
        msgs.add("user", new ActionMessage("error.user_not_login"));
        break;
      }
      if(loginUser.getId() != user.getId()){
        msgs.add("user", new ActionMessage("error.access_deny"));
        break;
      }
      UserBean ubean = UserDAO.getUserByID(user.getId());
      if (ubean == null || ubean.getStatus()!=UserBean.STATUS_NORMAL) {
        msgs.add("id", new ActionMessage("error.user_not_available",
            new Integer(user.getId())));
        break;
      }
      if (!StringUtils.equals(ubean.getPassword(), user
          .getPassword())){
        msgs.add("password",
            new ActionMessage("error.user_auth_failed"));
        break;
      }
      if(!StringUtils.equals(user.getQq(), ubean.getQq()) && StringUtils.isNumeric(user.getQq())){
        ubean.setQq(user.getQq());
        try {
          DLOGUserManager.update(ubean);
          //����session�е��û�����
          UserLoginManager.updateLoginUser(request, ubean);   
        } catch (Exception e) {
          msgs.add("result", new ActionMessage("error.database", e
              .getMessage()));
        }
      }
      break;
    }

    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("edituser");
    }

    StringBuffer ext = new StringBuffer();
View Full Code Here

  protected ActionForward doUpdate(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    UserForm user = (UserForm) form;
    super.validateClientId(request, user);
    ActionMessages msgs = new ActionMessages();
    // ��֤�û����ϱ�
    user.validateUserForm(request, msgs, false);
   
    while (msgs.isEmpty()) {
      UserBean loginUser = super.getLoginUser(request, response);
      if(loginUser == null) {
        msgs.add("user", new ActionMessage("error.user_not_login"));
        break;
      }
      if(loginUser.getId() != user.getId()){
        msgs.add("user", new ActionMessage("error.access_deny"));
        break;
      }
      UserBean ubean = UserDAO.getUserByID(user.getId());
      if (ubean == null || ubean.getStatus()!=UserBean.STATUS_NORMAL) {
        msgs.add("id", new ActionMessage("error.user_not_available",
            new Integer(user.getId())));
        break;
      }
      if (!StringUtils.equals(ubean.getPassword(), user
          .getPassword())){
        msgs.add("password",
            new ActionMessage("error.user_auth_failed"));
        break;
      }
      ubean.setNickname(super.autoFiltrate(null, user.getNickname()));
      if(user.getBirth()!=null && user.getBirth().before(new Date()))
        ubean.setBirth(user.getBirth());
      else if(ubean.getBirth()!=null)
        ubean.setBirth(null);
      ubean.setSex(user.getSex());
      if (StringUtils.isNotEmpty(user.getResume()))
        ubean.setResume(super.autoFiltrate(null, StringUtils.extractText(user.getResume())));
      else
        ubean.setResume(null);
      if (!StringUtils.equals(ubean.getPassword(), user.getPassword2())
          && StringUtils.isNotEmpty(user.getPassword2()))
        ubean.setPassword(user.getPassword2());
      if (StringUtils.isNotEmpty(user.getEmail()))
        ubean.setEmail(user.getEmail());
      else
        ubean.setEmail(null);
      if (StringUtils.isNotEmpty(user.getHomePage()))
        ubean.setHomePage(user.getHomePage());
      else
        ubean.setHomePage(null);
      if (StringUtils.isNotEmpty(user.getMobile()))
        ubean.setMobile(user.getMobile());
      else
        ubean.setMobile(null);
      if (StringUtils.isNotEmpty(user.getMsn()))
        ubean.setMsn(user.getMsn());
      else
        ubean.setMsn(null);
      if (StringUtils.isNotEmpty(user.getQq()))
        ubean.setQq(user.getQq());
      else
        ubean.setQq(null);
      if(!StringUtils.equals(ubean.getProvince(), user.getProvince()))
        ubean.setProvince(user.getProvince());
     
      if(!StringUtils.equals(ubean.getCity(), user.getCity()))
        ubean.setCity(user.getCity());
     
      if(user.getRemovePortrait()==1)
        ubean.setPortrait(null);
      else{
        String portrait_uri = handleUserPortrait(ubean.getId(), user.getPortrait());
        if(StringUtils.isNotEmpty(portrait_uri))
          ubean.setPortrait(portrait_uri);
      }
      try {
        DLOGUserManager.update(ubean);
        //����session�е��û�����
        UserLoginManager.updateLoginUser(request, ubean);   
      } catch (Exception e) {
        msgs.add("result", new ActionMessage("error.database", e
            .getMessage()));
      }
     
      break;
    }

    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("edituser");
    }

    StringBuffer ext = new StringBuffer();
View Full Code Here

      HttpServletRequest request, HttpServletResponse response)
      throws Exception
  {
    UserForm user = (UserForm) form;
    super.validateClientId(request, user);
    ActionMessages msgs = new ActionMessages();
    // ��֤�û�ע���
    user.validateUserForm(request, msgs, true);
    if (msgs.isEmpty()) {
      UserBean ubean = user.formToBean();
      try {
        ubean.setLastAddr(request.getRemoteAddr());
        ubean.setMobile(RequestUtils.getRequestMobile(request));
        ubean.setResume(super.filterScriptAndStyle(ubean.getResume()));
        DLOGUserManager.create(ubean);
        // ִ�е�¼����
        UserLoginManager.loginUser(request, response, ubean, user.getKeepDays());
      } catch (Exception e) {
        msgs.add("result", new ActionMessage("error.database", e.getMessage()));
      }
    } else {
      saveMessages(request, msgs);
      return mapping.findForward("reg");
    }
View Full Code Here

  protected ActionForward doUpdatePortrait(ActionMapping mapping, ActionForm form,
      HttpServletRequest request, HttpServletResponse response)
      throws Exception {
    UserForm user = (UserForm) form;
    super.validateClientId(request, user);
    ActionMessages msgs = new ActionMessages();
   
    while (msgs.isEmpty()) {
      UserBean loginUser = super.getLoginUser(request, response);
      if(loginUser == null) {
        msgs.add("user", new ActionMessage("error.user_not_login"));
        break;
      }
      if(loginUser.getId() != user.getId()){
        msgs.add("user", new ActionMessage("error.access_deny"));
        break;
      }
      UserBean ubean = UserDAO.getUserByID(user.getId());
      if (ubean == null || ubean.getStatus()!=UserBean.STATUS_NORMAL) {
        msgs.add("id", new ActionMessage("error.user_not_available",
            new Integer(user.getId())));
        break;
      }
      if (!StringUtils.equals(ubean.getPassword(), user
          .getPassword())){
        msgs.add("password",
            new ActionMessage("error.user_auth_failed"));
        break;
      }
      if(user.getRemovePortrait()==1)
        ubean.setPortrait(null);
      else{
        String portrait_uri = handleUserPortrait(ubean.getId(), user.getPortrait());
        if(StringUtils.isNotEmpty(portrait_uri))
          ubean.setPortrait(portrait_uri);
      }
      try {
        DLOGUserManager.update(ubean);
        //����session�е��û�����
        UserLoginManager.updateLoginUser(request, ubean);   
      } catch (Exception e) {
        msgs.add("result", new ActionMessage("error.database", e.getMessage()));
      }
     
      break;
    }

    if (!msgs.isEmpty()) {
      saveMessages(request, msgs);
      return mapping.findForward("edituser");
    }

    StringBuffer ext = new StringBuffer();
View Full Code Here

TOP

Related Classes of org.apache.struts.action.ActionMessages$ActionMessageItem

Copyright © 2018 www.massapicom. 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.