Differences between revisions 2 and 3
Revision 2 as of 2007-10-29 23:25:10
Size: 1798
Editor: c-76-105-214-41
Revision 3 as of 2009-09-20 22:06:21
Size: 1789
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
[wiki:VelocityTools2/GenericTools GenericTools], [wiki:VelocityTools2/VelocityView VelocityView] and [wiki:VelocityTools2/VelocityStruts VelocityStruts] are all defined via XML. [[VelocityTools2/GenericTools|GenericTools]], [[VelocityTools2/VelocityView|VelocityView]] and [[VelocityTools2/VelocityStruts|VelocityStruts]] are all defined via XML.

Providing an xml format configuration file is still the standard, but unlike VelocityTools 1.x, it is no longer necessary at all, thanks to the introduction of default configurations. The default configurations for GenericTools, VelocityView and VelocityStruts are all defined via XML.

Here's a somewhat thorough example:

    <toolbox scope="request" xhtml="true">
        <tool key="toytool" class="ToyTool" restrictTo="index.vm"/>
        <tool key="custom" class="org.mine.CustomTool" randomProperty="whatever"/>
    <toolbox scope="session">
        <property name="create-session" value="true" type="boolean"/>
        <tool key="map" class="java.util.HashMap"/>
    <toolbox scope="application">
        <tool class="org.apache.velocity.tools.generic.DateTool"/>
    <data type="number" key="version" value="1.1"/>
    <data key="date" value="Mon Sep 17 10:08:03 PDT 2007" class="java.util.Date" converter="org.apache.commons.beanutils.locale.converters.DateLocaleConverter"/>
    <data type="boolean" key="isSimple" value="true"/>
    <data key="foo" value="this is foo."/>
    <data key="bar">this is bar.</data>
    <data type="list" key="dataKeys" value="version,date,isSimple,foo,bar,dataKeys,switches"/>
    <data type="list.boolean" key="switches" value="true,false,false,true"/>

For those upgrading from VelocityTools 1.x, you will notice that the format has changed rather drastically. Not to worry, the old format is still supported, though it has been deprecated and does not offer as many features as the new one. We strongly recommend you upgrade to the new format.

VelocityTools2/ConfigXml (last edited 2009-09-20 22:06:21 by localhost)