Fork me on GitHub
Edit on GitHub << back to Tag Reference


Please make sure you have read the Tag Syntax document and understand how tag attribute syntax works.


Render a I18n text message.

The message must be in a resource bundle with the same name as the action that it is associated with. In practice this means that you should create a properties file in the same package as your Java class with the same name as your class, but with .properties extension.

If the named message is not found in a property file, then the body of the tag will be used as default message. If no body is used, then the stack can be searched, and if a value is returned, it will written to the output. If no value is found on the stack, the key of the message will be written out.

For more details on using resource bundles with Struts 2 read the localization guide.

Render a I18n text message


Dynamic Attributes Allowed:








escapeCsv false false false Boolean Whether to escape CSV (useful to escape a value for a column)
escapeHtml false false false Boolean Whether to escape HTML
escapeJavaScript false false false Boolean Whether to escape Javascript
escapeXml false false false Boolean Whether to escape XML
name true false String Name of resource property to fetch
performClearTagStateForTagPoolingServers false false false Boolean Whether to clear all tag state during doEndTag() processing (if applicable)
var false false String Name used to reference the value pushed into the Value Stack (scope: action).

NOTE: When the var attribute is used with the text tag, the tag’s generated value will not be written out to the visible page (it will only be placed into the action scope).


Accessing messages from a given bundle (the i18n Shop example bundle in the first example) and using bundle defined through the framework in the second example.

 <!-- First Example -->
 <s:i18n name="struts.action.test.i18n.Shop">
     <s:text name="main.title"/>

 <!-- Second Example -->
 <s:text name="main.title" />

 <!-- Third Examlpe -->
 <s:text name="i18n.label.greetings">
    <s:param >Mr Smith</s:param>

Other example

<s:text name=""><s:param name="value" value="myMoneyValue"/></s:text>

where the following is in a regular (possibly locale-specific) properties file:{0,number,currency}

For more about formatting text, see



If you wish to use i18n in your tag attributes

This will not work:

<s:textfield name="lastName" label="<s:text name="person.lastName"/>" ../>

Instead, you should use the getText() method that you inherit when your Action extends ActionSupport:

<s:textfield name="lastName" label="getText('person.lastName')" ../>