code: private DateFormat createFormatter(Locale loc, String pattern) throws JspException {
          // Apply pattern, if present
          if (pattern != null) {
              return new SimpleDateFormat(pattern, loc);
          }
  
          if ((type == null) || DATE.equalsIgnoreCase(type)) {
              int style = Util.getStyle(dateStyle, "FORMAT_DATE_INVALID_DATE_STYLE");
              return DateFormat.getDateInstance(style, loc);
          } else if (TIME.equalsIgnoreCase(type)) {
              int style = Util.getStyle(timeStyle, "FORMAT_DATE_INVALID_TIME_STYLE");
              return DateFormat.getTimeInstance(style, loc);
          } else if (DATETIME.equalsIgnoreCase(type)) {
              int style1 = Util.getStyle(dateStyle, "FORMAT_DATE_INVALID_DATE_STYLE");
              int style2 = Util.getStyle(timeStyle, "FORMAT_DATE_INVALID_TIME_STYLE");
              return DateFormat.getDateTimeInstance(style1, style2, loc);
          } else {
              throw new JspException(Resources.getMessage("FORMAT_DATE_INVALID_TYPE", type));
          }
      }
docs: Private utility methods