I am using the same stack as use albeit I am using my own freemarker manager (not struts built-in).
I don't have any problems calling "getters" from the action in ftl.
e.g. ${myValue}
-----Original Message-----
From: Daniel Dekany [mailto:
[hidden email]]
Sent: Friday, November 06, 2009 2:44 PM
To: Christopher Maloof
Cc:
[hidden email];
[hidden email]
Subject: Re: [FreeMarker-user] Trouble calling methods in a Struts 2
action
Friday, November 6, 2009, 6:32:05 PM, Christopher Maloof wrote:
> 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>?
What's the data-model in Struts? It had to be the MyAction instance,
or else the methods will no be visible.
> 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> _______________________________________________
> FreeMarker-user mailing list
>
[hidden email]
>
https://lists.sourceforge.net/lists/listinfo/freemarker-user>
--
Best regards,
Daniel Dekany
------------------------------------------------------------------------------
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_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-userThis message, including any attachments, is intended only for the recipient(s)
named above. It may contain confidential and privileged information. If you have
received this communication in error, please notify the sender immediately and
destroy or delete the original message. Also, please be aware that if you are not
the intended recipient, any review, disclosure, copying, distribution or any
action or reliance based on this message is prohibited by law.
------------------------------------------------------------------------------
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_______________________________________________
FreeMarker-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-user