I'm just starting to use FreeMarker (2.3.15) with Struts 2.1.8. It mostly works fine: my templates are retrieving bean information with no problem. However, I can't figure out how to call methods defined in my action classes.

If my action class looks like this:

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

Then these things work:
${myValue}  (indirect access to bean getter)
${myValue.toUpperCase()}  (method call on object)
<@s.property value="myMethod()"/>   (Struts tag calling a method)

But these things don't:
${myMethod()}
${getMyValue()}  (plain method calls as described in the docs)

Are public action methods not included in the data model for Freemarker, for some reason? The Freemarker docs (http://freemarker.org/docs/dgui_template_exp.html#dgui_template_exp_methodcall) seem to indicate that they ought to be.

Thanks for any help,
Chris


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to