Re: How to build a Custom Include method?

Attila Szegedi <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
On Jul 30, 2008, at 7:12 AM, Jeremy Chone wrote:

> Is there better way for doing this? Can I get some more context in a  
> TemplateMethodModelEx method ?

Environment.getCurrentEnvironment() gives you the current thread-local  
Environment object (which represents the context of the current  
Template.process() invocation). Environment.getOut() then gives you  
the current Writer.

But I agree with Jonathan's response to you that you might be happier  
with a custom template loader. (Depends on context of your problem,  
though -- template loader would be fine as long as your name  
transformations are stateless, not context dependent).

Attila.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.