Trouble calling methods in a Struts 2 action

Christopher Maloof <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
I'm just starting to use FreeMarker (2.3.15) with Struts 2.1.8.  It 
mostly works great: my templates are retrieving bean information with no 
problem.  However, I can't figure out how to call methods defined in my 
action classes -- in fact I have no idea why it isn't working as I expected.

If my action class looks like this:

public class MyAction extends MyActionSupport {
    public String getMyValue() {
       return "hello";
    }
    public String myMethod() {
       return "world";
    }
}

then ${myValue} or ${myValue.toUpperCase()} works fine, as does 
<@s.property value="myMethod()"/>, but ${myMethod()}results in a 
"Expression myMethod is undefined" error.  The docs 
(http://freemarker.org/docs/dgui_template_exp.html#dgui_template_exp_methodcall) 
seem to think this should be perfectly fine, as far as I can tell.

Any idea why Freemarker isn't seeing the top-level action methods unless 
I use <@s.property>?

Thanks for any help -
Chris


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
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.