Hi Tao,

I don't think there's an easy way to do this, though there are a few avenues to explore:

1. Look at the EventCartridge & EventHandlers, specifically implementing o.a.v.app.event.ReferenceInsertionEventHandler would allow you to do *something* just before the value is put into the template (I realise this isn't quite what you want to do).

Chapter 9 at: http://jakarta.apache.org/velocity/developer-guide.html


2. This would be the best way: implement your own introspector, probably extending o.a.v.util.introspection.UberspectImpl and wrapping the calls to that implementation. I'd imagine others would be interested in your results if you did choose this approach.



3. The hack approach: wrap all your getXXX calls in a macro which does something either side of the call. Something along the lines of:


#macro( doAOPGet $object $variableName )
.. your pre-get stuff here
$object.get( "$variableName" )
.. your post-get stuff here
#end


Hope I'm not too far off the target - not yet gotten into AOP so not really sure what you might typically want to achieve!


- simon


Perfect Tao wrote:
Hi Velocity fans
I have a question of Velocity


I need a function:
It is exec a especial method before or after exec every getXXX() when  merge 
template

Like AOP function.

How implement it?. Or tell me idea. I wrote code by your idea. â


Thank you
Best Regards
Perfect Tao
Email: [EMAIL PROTECTED]
Yahoo Messeger ID: perfect_tao
Skype ID :perfect_tao
====================================
The doors of wisdom are never shut. ====================================

--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to