Child pages
  • text
Skip to end of metadata
Go to start of metadata

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



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




{snippet:id=exdescription|lang=none|javadoc=true|url=org.apache.struts2.components.Text} {snippet:id=example|lang=xml|javadoc=true|url=org.apache.struts2.components.Text}

Other example

xml <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:

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

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

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

1 Comment

  1. Actually the syntax proposed is not exact, at least for a button. The following syntax gave me the expected result : <s:submit name="Create" value="%

    Unknown macro: {getText('')}

    " method="prepareCreateDomain"/>