struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Maloof <C_Mal...@mail.jci.tju.edu>
Subject Re: Trouble calling action methods from FreeMarker
Date Tue, 10 Nov 2009 15:32:36 GMT
I guess no one recognizes the problem.  Next question: Has anyone gotten 
this (calling action methods from FreeMarker tags) to work 
successfully?  Just trying to figure out whether the correct approach is 
to hammer on my configuration somehow, or to file a bug.

Thanks,
Chris

On 11/9/2009 10:13 AM, Christopher Maloof wrote:
> 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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message