$formatter.formatShortDate($object.Date)
$formatter.formatLongDate($db.getRecord(232).getDate())
$formatter.formatArray($array)
$formatter.limitLen(30, $object.Description)
<table>
$formatter.makeAlternator("rowColor", "#c0c0c0", "#e0e0e0")
#foreach $item in $items
<tr><td bgcolor="$rowColor">$item.Name</td></tr>
$rowColor.alternate()
#end
</table>
alternate()
automatically on rendering in a template.
and that is the same thing we are trying to allow here.MyClass.STRING_CONSTANT
and then in your template, you can access any of your static fields in this way :context.put("runtime", new FieldMethodizer( "NVelocity.Runtime.Runtime" ));
$runtime.RUNTIME_LOG_WARN_STACKTRACE
public static
fields. It seems
that anything else is too dangerous. This class is for convenience accessing
'constants'. If you have fields that aren't static
it may be better
to handle them by explicitly placing them into the context.Template
from the Velocity
resource management system.
Template
from the Velocity
resource management system.
Determines whether a resource is accessible via the
currently configured resource loaders.
Note that the current implementation will not change the state of the system in any real way - so this cannot be used to pre-load the resource cache, as the previous implementation did as a side-effect.
Set the an ApplicationAttribute, which is an Object set by the application which is accessible from any component of the system that gets a RuntimeServices. This allows communication between the application environment and custom pluggable components of the Velocity engine, such as loaders and loggers.
Note that there is no enforcement or rules for the key used - it is up to the application developer. However, to help make the intermixing of components possible, using the target Class name (e.g. com.foo.bar ) as the key might help avoid collision.
Template
from the Velocity
resource management system.
Template
from the Velocity
resource management system.
Set the an ApplicationAttribute, which is an Object set by the application which is accessible from any component of the system that gets a RuntimeServices. This allows communication between the application environment and custom pluggable components of the Velocity engine, such as loaders and loggers.
Note that there is no enforcement or rules for the key used - it is up to the application developer. However, to help make the intermixing of components possible, using the target Class name (e.g. com.foo.bar ) as the key might help avoid collision.
key = value
# lines starting with # are comments # This is the simplest property key = value # A long property may be separated on multiple lines longvalue = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa # This is a property with many tokens tokens_on_a_line = first token, second token # This sequence generates exactly the same result tokens_on_multiple_lines = first token tokens_on_multiple_lines = second token # commas may be escaped in tokens commas.excaped = Hi\, what'up?
true
, on
,
and yes
for a true
boolean value, and
false
, off
, and no
for
false
boolean values. Case of value to test for
boolean status is ignored.
*
true
or false
if the supplied
text maps to a boolean value, or null
otherwise.
null
if unmapped.null
if unmapped.
This class is responsible for instantiating the correct LoggingSystem
The approach is :
Resource
.
false
.
resource.manager.cache.size
property (identified by the
{@link
org.apache.velocity.runtime.RuntimeConstants#RESOURCE_MANAGER_CACHE_SIZE}
constant). This property get be set to 0
or less for
a greedy, unbounded cache (the behavior from pre-v1.5).
*
initialize()
method.
Resource
objects,
given name and type.
Template
, Content
, etc.).
The character encoding to use.
Template
to Template
).
*
Template
,
Content
, etc.).
The character encoding to use.
Template
,
Content
, etc.).
The character encoding to use.
Template
to Template
).
*
Template
,
Content
, etc.).
Template
from the resource manager.
This method assumes that the character encoding of the
template is set by the input.encoding
property. The default is "ISO-8859-1"
*
Template
from the resource manager
*
resource.manager.cache.class
property
specifies the name of the resource.manager.cache.size
property
specifies the cache upper bound (if relevant).
Runtime.setProperty(Runtime.FILE_RESOURCE_LOADER_PATH, templatePath);
Runtime.setProperty(Runtime.RUNTIME_LOG, pathToVelocityLog);
Runtime.init();
----------------------------------------------------------------------- N O T E S O N R U N T I M E I N I T I A L I Z A T I O N ----------------------------------------------------------------------- Runtime.init() If Runtime.init() is called by itself the Runtime will initialize with a set of default values. ----------------------------------------------------------------------- Runtime.init(String/Properties) In this case the default velocity properties are layed down first to provide a solid base, then any properties provided in the given properties object will override the corresponding default property. -----------------------------------------------------------------------
ExtendedProperties loaderConfiguration =
configuration.subset(loaderID);
And a configuration is a lot more convenient to deal
with then conventional properties objects, or Maps.
Template
from the resource manager.
This method assumes that the character encoding of the
template is set by the input.encoding
property. The default is "ISO-8859-1"
Template
from the resource manager
RuntimeSingleton.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH, templatePath); RuntimeSingleton.setProperty(RuntimeConstants.RUNTIME_LOG, pathToVelocityLog); RuntimeSingleton.init();
----------------------------------------------------------------------- N O T E S O N R U N T I M E I N I T I A L I Z A T I O N ----------------------------------------------------------------------- RuntimeSingleton.init() If Runtime.init() is called by itself the Runtime will initialize with a set of default values. ----------------------------------------------------------------------- RuntimeSingleton.init(String/Properties) In this case the default velocity properties are layed down first to provide a solid base, then any properties provided in the given properties object will override the corresponding default property. -----------------------------------------------------------------------
resource.loader = file
is already present in the configuration and you
addProperty("resource.loader", "classpath")
Then you will end up with an ArrayList like the
following:
["file", "classpath"]
Template
from the resource manager.
This method assumes that the character encoding of the
template is set by the input.encoding
property. The default is "ISO-8859-1"
*
Template
from the resource manager
*
#macro()
arguments. The 0th is the name.
Source template
A view tool that allows template designers to load an arbitrary object into the context. Any object with a public constructor without parameters can be used as a view tool.
THIS CLASS IS HERE AS A PROOF OF CONCEPT ONLY. IT IS NOT INTENDED FOR USE IN PRODUCTION ENVIRONMENTS. USE AT YOUR OWN RISK.
source
.
The column number from source
.
SOURCE
[line X, column Y]
.
name
and
params
for the Class c
.
name
for the Class c
.
name
and
params
for the Class c
.
name
for the Class c
.
$foo.bar
Makes the first letter caps and the rest lowercase.
*
For example fooBar
becomes Foobar
.
null
instead.
*
Template template = Velocity.getTemplate("test.wm");
IContext context = new VelocityContext();
context.Put("foo", "bar");
context.Put("customer", new Customer());
template.Merge(context, writer);
Context
implementation to wrap.
null
), and
inner context.
null
to
create default storage.
Inner context.