Thanks Bob
This is how we do it now, but I want to add tool to global context (ie make it available in all templates) Adding it as model property to base page is not working when you generating template as a string

Answering you question, configuring Velocity tools can be done via xml, property file or java code (see http://velocity.apache.org/tools/devel/config.html)
I've tried 1 and 2 but wasn't able to make it work

23.04.2013 21:35, Bob Schellink пишет:
Hi,

I've never used Velocity Tools. How does one integrate the tools in standalone mode of Velocity? Is it enough to simply configure it inside velocity.properties or is some other configuration needed?

However since it looks like most Velocity Tools are POJO's, you could do the following in your BorderPage:

public BorderPage() {
        addModel("esc", new EscapeTool());
 }

Kind regards

Bob

On 2013/04/23 15:41, Aleksei Pokrevskiy wrote:
Hello
how can I add EscapeTool to global velocity context?
I've tried adding velocity.properties to WEB-INF directory with content:

tools.toolbox = request
tools.data.version = 2.0
tools.data.version.type = number
tools.application.esc = org.apache.velocity.tools.generic.EscapeTool

and tools.xml with content:

<tools>
    <data key="version" type="number" value="2.0"/>
    <toolbox scope="application">
<tool class="org.apache.velocity.tools.generic.EscapeTool" key="esc"/>
    </toolbox>
</tools>

and still get $esc undefined in templates




Reply via email to