Package org.g4studio.core.mvc.xstruts.util

Examples of org.g4studio.core.mvc.xstruts.util.MessageResources


   *            servlet request
   * @param key
   *            the request key
   */
  public static String getMessage(HttpServletRequest request, String key) {
    MessageResources messages = getMessageResources(request);

    return getMessage(messages, RequestUtils.getUserLocale(request, null), key);
  }
View Full Code Here


      return msg.getKey();
    }

    String msgKey = null;
    String msgBundle = null;
    MessageResources messages = defaultMessages;

    if (msg == null) {
      msgKey = va.getMsg();
    } else {
      msgKey = msg.getKey();
      msgBundle = msg.getBundle();

      if (msg.getBundle() != null) {
        messages = getMessageResources(application, request, msg.getBundle());
      }
    }

    if ((msgKey == null) || (msgKey.length() == 0)) {
      return "??? " + va.getName() + "." + field.getProperty() + " ???";
    }

    // Get the arguments
    Arg[] args = field.getArgs(va.getName());
    String[] argValues = getArgValues(application, request, messages, locale, args);

    // Return the message
    return messages.getMessage(locale, msgKey, argValues);
  }
View Full Code Here

    if ((msgKey == null) || (msgKey.length() == 0)) {
      return new ActionMessage("??? " + va.getName() + "." + field.getProperty() + " ???", false);
    }

    ServletContext application = (ServletContext) validator.getParameterValue(SERVLET_CONTEXT_PARAM);
    MessageResources messages = getMessageResources(application, request, msgBundle);
    Locale locale = RequestUtils.getUserLocale(request, null);

    Arg[] args = field.getArgs(va.getName());
    String[] argValues = getArgValues(application, request, messages, locale, args);

    ActionMessage actionMessage = null;

    if (msgBundle == null) {
      actionMessage = new ActionMessage(msgKey, argValues);
    } else {
      String message = messages.getMessage(locale, msgKey, argValues);

      actionMessage = new ActionMessage(message, false);
    }

    return actionMessage;
View Full Code Here

    String[] values = new String[args.length];

    for (int i = 0; i < args.length; i++) {
      if (args[i] != null) {
        if (args[i].isResource()) {
          MessageResources messages = defaultMessages;

          if (args[i].getBundle() != null) {
            messages = getMessageResources(application, request, args[i].getBundle());
          }

          values[i] = messages.getMessage(locale, args[i].getKey());
        } else {
          values[i] = args[i].getKey();
        }
      }
    }
View Full Code Here

TOP

Related Classes of org.g4studio.core.mvc.xstruts.util.MessageResources

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.