myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe" <>
Subject Re: MyfacesBuilderPlugin
Date Thu, 03 Apr 2008 23:44:58 GMT
On Thu, Apr 3, 2008 at 5:33 PM, Mike Kienenberger <>

> I have not seen the specifics of this project, but if you're using
> velocity, you should be able to have the code which initializes
> velocity automatically populate something like $utils instead of doing
> it in the velocity template language.
> I also think you're better off NOT putting velocity-specific utilities
> on the data model.  Determine if those methods would make sense if you
> were not using velocity, and if that's the case, keep it on a separate
> java object (By the way, these separate java objects are called
> "tools" in the velocity jargon.).

Good rule of thumb. Thanks

> I'm not sure what the ideal way of doing this from maven is, but in
> ant, we typically configured these tools using the BSD-licensed
> VPP-provided ant tasks.
> It's not all difficult to do this in java code, if you have direct
> control over the code setting up the Velocity engine.
> velocityContext.put("stringUtils", new StringUtils());
> velocityContext.put("myfacesUtils", new MyfacesUtils());
One option in maven is use plexus-velocity, but this has a problem: in this
case the velocity engine
must be initialized with some custom params. So initialization is done using
hand code. The drawback
is that creates a log file on the project folder (I'm not found how to
output the log on the screen yet!).

The idea is for each template use a Velocity context with this params

context.put("stringUtils", new StringUtils());
context.put("utils", new Utils());
context.put("component", component);

Again thanks for your suggestions


Leonardo Uribe

View raw message