Hi,

What exactly is the lifecylcle of a directive? Is is the case that a 
userdirective class is instantiated and init() called during velocity's 
initialization, with render() subsequently being called for each reference to 
the directive in a template?

Is there an event handler for either the init() or render() methods?

The reason I ask: I'm looking to "inject" a small collection of support/service 
objects into a directive. This could be done either at init or render (although 
more efficient at init, if my directive lifecycle assumption is correct).

I'm trying to work out the best way to achieve this so that Velocity does not 
end up being too tightly coupled to the service objects (which are part of 
another application) and the directive code remains relatively clean

My solution at the moment is to have a factory class (the implementation for 
which is specified in velocity.properties) ... my directive init then uses 
introspection to retrieve the factory - which in turn allows the directive to 
retrieve instances of the support objects.

Is there a standard way to do this kind of thing in Velocity?

Any comments/suggestions/tips gratefull received.

Thanks,

Chris

********************************************************************************
   
DISCLAIMER: This e-mail is confidential and should not be used by anyone who is
not the original intended recipient. If you have received this e-mail in error
please inform the sender and delete it from your mailbox or any other storage
mechanism. Neither Macmillan Publishers Limited nor any of its agents accept
liability for any statements made which are clearly the sender's own and not
expressly made on behalf of Macmillan Publishers Limited or one of its agents.
Please note that neither Macmillan Publishers Limited nor any of its agents
accept any responsibility for viruses that may be contained in this e-mail or
its attachments and it is your responsibility to scan the e-mail and 
attachments (if any). No contracts may be concluded on behalf of Macmillan 
Publishers Limited or its agents by means of e-mail communication. Macmillan 
Publishers Limited Registered in England and Wales with registered number 
785998 
Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS   
********************************************************************************

Reply via email to