Пример #1
0
  /**
   * Checks for errors in the error map and transforms them to struts action messages then stores in
   * the request.
   */
  private void publishMessages(HttpServletRequest request) {
    MessageMap errorMap = GlobalVariables.getMessageMap();
    if (!errorMap.hasNoErrors()) {
      ErrorContainer errorContainer = new ErrorContainer(errorMap);

      request.setAttribute("ErrorContainer", errorContainer);
      request.setAttribute(Globals.ERROR_KEY, errorContainer.getRequestErrors());
      request.setAttribute("ErrorPropertyList", errorContainer.getErrorPropertyList());
    }

    if (errorMap.hasWarnings()) {
      WarningContainer warningsContainer = new WarningContainer(errorMap);

      request.setAttribute("WarningContainer", warningsContainer);
      request.setAttribute("WarningActionMessages", warningsContainer.getRequestMessages());
      request.setAttribute("WarningPropertyList", warningsContainer.getMessagePropertyList());
    }

    if (errorMap.hasInfo()) {
      InfoContainer infoContainer = new InfoContainer(errorMap);

      request.setAttribute("InfoContainer", infoContainer);
      request.setAttribute("InfoActionMessages", infoContainer.getRequestMessages());
      request.setAttribute("InfoPropertyList", infoContainer.getMessagePropertyList());
    }
  }