Re: Another Idea/Question

Luther Baker <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
On Nov 13, 2008, at 6:53 AM, Daniel Dekany wrote:

> Saturday, November 8, 2008, 6:29:38 PM, Luther Baker wrote:
>
>> Hope I'm not bothering anyone's time but wanted to run another idea  
>> past you.
>>
>> <snip.../>
>>
>> but it would still work. Is there a more elegant way to do this in  
>> FM?
>
> I think the usual way of doing this is that you write the "editor"
> macro in FTL, and then that macro calls out for the java code
> explicitly:
>
> <#macro editor>
>  <#local m = macroHelpers.editor()> <#-- calls a Java method -->
>  ${m.fieldOne} ${m.fieldTwo}
> </#macro>
>
>

Regarding 'maroHelper.editor()' ... is that an arbitrary invocation on  
a Java POJO? or in your example - is 'macroHelpers' the namespace and  
'editor' a variable name assigned to an instance of some new  
TemplateMethodModel you might have written in which case, your example  
would execute "exec(List args)" which returns an HashMap type of  
TemplateModel?

Hope that's not a confusing question. I assume you'd invoke a  
TemplateDirectiveModel with a different syntax ... so I'm essentially  
just clarifying whether or not you are invoking the exec operation on  
a TemplateMethodModel ... or executing an arbitrary method on a  
POJO ... or something else that Im missing.

Thanks much,

-Luther


-------------------------------------------------------------------------
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.