You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Martin Roller <Ma...@dynaware.de> on 2003/06/02 18:45:16 UTC

non-caching macro library & method pointers

Hi,

I'm new to velocity and have a few questions.
The mailarchive
   http://www.mail-archive.com/velocity-user@jakarta.apache.org/
appears to be down, so sorry if I ask obvious questions.

1. I would like to use the realoading feature of the global macro library.
   However, I can only see changes to VM_global_library.vm after the
   Server is restarted.

   I use Velocity 1.3.1 and tomcat 4.0.1
   I use the following config parameters

file.resource.loader.description = Velocity File Resource Loader
file.resource.loader.class =
org.apache.velocity.runtime.resource.loader.FileResourceLoader
file.resource.loader.path = <some path>/WEB-INF/classes
file.resource.loader.cache = false
file.resource.loader.modificationCheckInterval = 1

velocimacro.library = VM_global_library.vm
velocimacro.permissions.allow.inline = true
velocimacro.permissions.allow.inline.to.replace.global = true
# velocimacro.permissions.allow.inline.local.scope = false
# velocimacro.context.localscope = false
velocimacro.library.autoreload = true

2. Can I load the global library via another loader? I would like to
   specify the path relative, e.g. relative to the classpath, so I can
   pack velocity.properties in a war file.

3. Is it possible to specify methods at runtime? I would like to to
   something like the following.

   #set ($method = "myMethod")
   $object.$method.$argument

Thanks,
Martin Roller
Dynaware


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Re: non-caching macro library & method pointers

Posted by Nathan Bubna <na...@esha.com>.
Martin Roller said:
...
> I'm new to velocity and have a few questions.
> The mailarchive
>    http://www.mail-archive.com/velocity-user@jakarta.apache.org/
> appears to be down, so sorry if I ask obvious questions.

there are other archives of this list too:
http://marc.theaimsgroup.com/?l=velocity-user&r=1&w=2
http://nagoya.apache.org/eyebrowse/SummarizeList?listId=103

> 1. I would like to use the realoading feature of the global macro library.
>    However, I can only see changes to VM_global_library.vm after the
>    Server is restarted.

if you can't get it working, you could always just leave the 'allow inline to
override global' property as true and do #parse( "VM_global_library.vm" ) in one
of your templates to test.  i do this sometimes in dev.  i would not do it in
production.

> 2. Can I load the global library via another loader? I would like to
>    specify the path relative, e.g. relative to the classpath, so I can
>    pack velocity.properties in a war file.

you can specify multiple resource loaders for Velocity to search when trying to
load a template.  the developer's guide addresses this.

> 3. Is it possible to specify methods at runtime? I would like to to
>    something like the following.
>
>    #set ($method = "myMethod")
>    $object.$method.$argument

heh.  as Jon used to always say, "this isn't perl."  but you can pull this off
using a tool.  there are two tools available for this in the velocity-tools
project--the RenderTool and the ViewRenderTool.

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org