Exemple #1
0
  /**
   * Gets the locale sensitive message based on the <code>ValidatorAction</code> message and the
   * <code>Field</code>'s arg objects.
   *
   * @param messages The Message resources
   * @param locale The locale
   * @param va The Validator Action
   * @param field The Validator Field
   */
  public static String getMessage(
      MessageResources messages, Locale locale, ValidatorAction va, Field field) {

    String args[] = getArgs(va.getName(), messages, locale, field);
    String msg = field.getMsg(va.getName()) != null ? field.getMsg(va.getName()) : va.getMsg();

    return messages.getMessage(locale, msg, args);
  }
Exemple #2
0
  /**
   * Gets the <code>ActionMessage</code> based on the <code>ValidatorAction</code> message and the
   * <code>Field</code>'s arg objects.
   *
   * @param request the servlet request
   * @param va Validator action
   * @param field the validator Field
   */
  public static ActionMessage getActionMessage(
      HttpServletRequest request, ValidatorAction va, Field field) {

    String args[] =
        getArgs(
            va.getName(),
            getMessageResources(request),
            RequestUtils.getUserLocale(request, null),
            field);

    String msg = field.getMsg(va.getName()) != null ? field.getMsg(va.getName()) : va.getMsg();

    return new ActionMessage(msg, args);
  }