Пример #1
0
  @Override
  public String execute() {
    HttpServletRequest request = ServletActionContext.getRequest();
    User entity;
    UserHelper userHelper = AppContextUtil.getAppContext().getBean("userHelper", UserHelper.class);
    try {
      String createUserLoginId = ParamUtil.getString(request, "createUserLoginId");
      if (userHelper.getUserByUserId(createUserLoginId) != null) {
        request.setAttribute(
            AppConsts.MSG_ERROR, MessageHelper.getMessage(MessageConsts.USER_EXIST));
        return ERROR;
      }

      entity = setEntity(request);

      userHelper.saveEntity(entity);
    } catch (Exception e) {
      if (MessageConsts.MSG_COMMON_SESSION_TIMEOUT.equals(e.getMessage())) {
        request.setAttribute(AppConsts.MSG_ERROR, MessageHelper.getMessage(e.getMessage()));
      } else {
        request.setAttribute(
            AppConsts.MSG_ERROR, MessageHelper.getMessage(MessageConsts.MSG_PAYMENT_ERROR));
      }
      return ERROR;
    }
    request.setAttribute("xID", String.valueOf(entity.getxID()));

    request.setAttribute(
        AppConsts.MSG_SUCCESS, MessageHelper.getMessage(MessageConsts.MSG_COMMON_SUBMIT_SUC));
    entity = userHelper.getUserByXId(entity.getxID());
    // request.setAttribute("entity", entity);
    return SUCCESS;
  }
Пример #2
0
 @Override
 public String execute() {
   logger.info("----->PaymentEditAction execute");
   HttpServletRequest request = ServletActionContext.getRequest();
   // Handle The Switch
   String method = ParamUtil.getString(request, "methodName");
   try {
     if ("search".equals(method)) {
       // TODO
       logger.info("----->PaymentEditAction do Search");
       search(request);
     } else if ("edit".equals(method)) {
       logger.info("----->PaymentEditAction do Edit");
       try {
         // TODO
         edit(request);
       } catch (Exception e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
       }
     }
   } catch (Exception e) {
     if (MessageConsts.MSG_COMMON_SESSION_TIMEOUT.equals(e.getMessage())) {
       request.setAttribute(AppConsts.MSG_ERROR, MessageHelper.getMessage(e.getMessage()));
     } else {
       request.setAttribute(
           AppConsts.MSG_ERROR, MessageHelper.getMessage(MessageConsts.MSG_PAYMENT_ERROR));
     }
     return ERROR;
   }
   return SUCCESS;
 }