Here are some good examples about how to extend Velocity, including the creation of custom directives...
http://wiki.apache.org/jakarta-velocity/HackingVelocity WILL On 7/31/06, Maxim Gordienko <[EMAIL PROTECTED]> wrote:
The reason is quite simple. The macro logic is quite complicated and cumbersome. It hardly can be implemented in velocity template. It's legacy architecture "feature" - view asks business logic for a model. Maybe I do not need macro and directive works just well. I need to define some kind of "shortcut" for view developer who can use it in any view. And a logic behind this "shortcut" is actually evaluated only if velocity engine encounter "shortcut" in rendered view. Can you point out where i can find info about custom directive? Thank you! On 7/31/06, Nathan Bubna <[EMAIL PROTECTED]> wrote: > Is there some particular reason you want to attach the macro to a > specific context? If you are just wanting to define a "Velocimacro" > in a java class, than you can create a custom directive. But those > must be associated with a VelocityEngine before initialization. > > Your other option would be to "Use A Tool". This could be a tool > that takes advantage of the VelocityTools support or just any old > POJO. Have it take the parameters you want and generate the output > you want. Then you just put it in your context and use it. > > Other than these alternatives, no, i don't believe it is possible to > define a Velocimacro in a java class and attach it to a specific > context. > > On 7/30/06, Maxim Gordienko <[EMAIL PROTECTED]> wrote: > > Hello! > > > > Is it possible to define Velocimacro in java class (implementing some > > interface, extending some base class etc.), somehow register it in > > context and use it just like macro defined inline or in macros > > library? > > > > Thank you. > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- Forio Business Simulations Will Glass-Husain [EMAIL PROTECTED] www.forio.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]