Package org.apache.struts2.util
Class TextProviderHelper
java.lang.Object
org.apache.struts2.util.TextProviderHelper
Helper methods to access text from TextProviders
-
Constructor Summary
Constructors -
Method Summary
-
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 bundledefaultMessage
- the message to return if not found (evaluated for OGNL)args
- an array args to be used in aMessageFormat
messagestack
- the value stack to use for finding the text- Returns:
- the message if found, otherwise the defaultMessage
-
getText
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 bundledefaultMessage
- the message to return if not foundstack
- the value stack to use for finding the text- Returns:
- the message if found, otherwise the defaultMessage
-