Thanks Bob
from what I have understand there's no possibility to add tool to global
context in Click
24.04.2013 12:28, Bob Schellink пишет:
I don't think Velocity Tools works by only configuring it. See here:
http://velocity.apache.org/tools/devel/frameworks.html
So Tools won't be available in Click since Click doesn't use
VelocityView or any Tools specific APIs. That is my understanding of
Tools anyway.
> Adding it as model property to base page is not working when you
generating template as a string
You mean Context.renderTemplate?
you still provide the model so can add the tools you want there or
through a utility method?
Kind regards
Bob
On 2013/04/24 09:20, Aleksei Pokrevskiy wrote:
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