Copyright© 2008-2022 Sitevision AB, all rights reserved.
public interface VelocityEvaluator
An instance of this interface can never be directly created and all instances are heavily bound to the Velocity context they were created for.
VelocityRenderer
Modifier and Type | Method and Description |
---|---|
void |
evaluate(String aTemplate)
Renders a template that is parsed/evaluated by Velocity.
|
void evaluate(String aTemplate)
Note! This method is intended for usage from within Velocity only
(e.g. $aVelocityEvaluatorInstance.evaluate($aTemplateString)
),
see VelocityRenderer
for an example.
Tip when evaluating velocity files in a custom portlet! The path to your portlet's velocity file(-s) are class loader dependant and therefore likely to have it's root from the "classes" folder of your war. An example, your portlet war looks like this:
[META-INF] |- context.xml [WEB-INF] |- portlet.xml |- web.xml |- [classes] | |- [com] | |- [mycompany] | |- [myportlet] | |- MyPortlet.class |- [resources] |- myvelocityfile.vm
If you want to use a VelocityEvaluator to evaluate the myvelocityfile.vm
in the MyPortlet.class
,
your velocity file path would likely be "../resources/myvelocityfile.vm"
.
aTemplate
- a String containing the Velocity code to be parsed or a path to a velocity template file
(suffix must be ".vm" and path must not contain any space character)Sitevision - Portal and Content Management Made Easy
Sitevision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2022 Sitevision AB, all rights reserved.