Class ViewResourceTool

  extended by
      extended by

public class ViewResourceTool
extends ResourceTool

Tool for accessing ResourceBundles and formatting messages therein.

 Template example(s):
   $                      ->  bar
   $              ->  Hello World!
   #set( $otherText = $text.bundle('otherBundle') )
   $                 ->  woogie
   $                 ->  The args are {0} and {1}.
   $       ->  The args are 4 and {1}.
   $,true)  ->  The args are 4 and true.

 Toolbox configuration example:
   <parameter name="bundles" value="resources,"/>

This comes in very handy when internationalizing templates. Note that the default resource bundle baseName is "resources", and the default locale is the result of HttpServletRequest.getLocale(). The default bundle baseName can be overridden as shown above.

Also, be aware that very few performance considerations have been made in this initial version. It should do fine, but if you have performance issues, please report them to, so we can make improvements.

This tool is NOT meant to be used in either application or session scopes of a servlet environment.

VelocityTools 1.3
$Revision: 497990 $ $Date: 2006-11-27 10:49:37 -0800 (Mon, 27 Nov 2006) $
Nathan Bubna

Nested Class Summary
Nested classes/interfaces inherited from class
Field Summary
Fields inherited from class
Constructor Summary
Method Summary
 void init(java.lang.Object obj)
          Initializes this instance.
Methods inherited from class
bundle, configure, get, get, get, getDefaultBundle, getDefaultLocale, insert, insert, insert, insert, locale, render, setDefaultBundle, setDefaultLocale
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public ViewResourceTool()
Method Detail


public void init(java.lang.Object obj)
Initializes this instance.

obj - the current ViewContext

Copyright (c) 2003-2007 Apache Software Foundation