TextFormatter Viewtool

The TextFormatter is a helper class to simplify tool usage when retrieving no-arg messages from the default bundle that have periods in their key.

The following example shows how the TextFormatter is mapped in the toolbox.xml file:

<tool> <key>messages</key> <scope>request</scope> <class> org.apache.velocity.tools.struts.ActionMessagesTool </class> </tool>

Example#

So instead of '$text.get("forms.profile.title")', you can just type $text.forms.profile.title. This also lets you do things like:

#if($text.forms.profile.exists ) #set( $profiletext = $text.forms.profile ) <h1>$profiletext.title</h1> <h3>$profiletext.subtitle</h3> #end