setting variables from within a custom TemplateDirectiveModel

Grégory Joseph <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Hi,

I have a TemplateDirectiveModel which renders its body - pretty straightforward.

            body.render(env.getOut());

Now, what I'd need is to push variables to be used by this body. I've tried the following, before calling body.render:
            //env.setLocalVariable("myVar", new SimpleScalar("local!"));
            env.setVariable("myVar", new SimpleScalar("regular!"));
            env.setGlobalVariable("myVar", new SimpleScalar("global!"));

.. to no avail. Am I missing something, or is there something else I should be looking at ? I'm not too keen on using loopVars, because in this case, the user of my directive shouldn't even know about the variable i'm trying to push - and here comes my use case: I need to share some information from this directive to other (custom) directives which are being used in the body of the former.

Any idea or suggestion ?

Cheers,

-greg

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
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.