Tag Name: <a2:text />

Description

Render a I18n text message.

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, then the body of the tag will be used as default message. If no body is used, then the name of the message will be used.

Example:

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

  <!-- First Example --> <a:i18n name="struts.action.test.i18n.Shop"> <a:text name="main.title"/> </a:i18n> <!-- Second Example --> <a:text name="main.title" />  
  <-- Third Example --> <a:text name="some.key" /> <-- Fourth Example --> <a:text name="some.invalid.key" > The Default Message That Will Be Displayed </a:text>  

Attributes

Name

Required

Default

Type

Description

name true   Object/String Name of resource property to fetch
id false   Object/String id for referencing element. For UI and form tags it will be used as HTML id attribute

Back to Taglib Index