Class TextProviderHelper

java.lang.Object
org.apache.struts2.util.TextProviderHelper

public class TextProviderHelper extends Object
Helper methods to access text from TextProviders
  • Constructor Details

    • TextProviderHelper

      public TextProviderHelper()
  • Method Details

    • getText

      public static String getText(String key, String defaultMessage, List<Object> args, ValueStack stack)

      Get a message from the first TextProvider encountered in the stack. If the first TextProvider doesn't provide the message the default message is returned.

      The stack is searched if if no TextProvider is found, or the message is not found.
      Parameters:
      key - the message key in the resource bundle
      defaultMessage - the message to return if not found (evaluated for OGNL)
      args - an array args to be used in a MessageFormat message
      stack - the value stack to use for finding the text
      Returns:
      the message if found, otherwise the defaultMessage
    • getText

      public static String getText(String key, String defaultMessage, ValueStack stack)

      Get a message from the first TextProvider encountered in the stack. If the first TextProvider doesn't provide the message the default message is returned.

      The search for a TextProvider is iterative from the root of the stack.

      This method was refactored from Text to use a consistent implementation across UIBean components.

      Parameters:
      key - the message key in the resource bundle
      defaultMessage - the message to return if not found
      stack - the value stack to use for finding the text
      Returns:
      the message if found, otherwise the defaultMessage