Dear Magnolians

Can someone give me a quick primer on how to call java methods from a 
Freemarker template? From looking at the documentation one does not seem to be 
able to simply call a method in an object. It looks like the methods need to be 
implemented as subclass of "TemplateMethodModel" (see [1]). This seems quite 
complicated, but I guess I could do that. But then, where is this method added 
to the data model (i.e. "root.put("methodName", new MethodClass())?

To be more specific: I would like to access the user info in a Freemarker 
template, where I only have the username. So I would need a method which would 
return the user (object? "data-model"? hash?) when passing in the username. I 
am using the TemplatedMVCHandler class to display the template. The template 
displays fine. But now I'm a bit stuck with adding the method...

Thanks for the insight!
-will


[1] http://freemarker.sourceforge.net/docs/pgui_datamodel_method.html

----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to