Hi Chris,

See reply embedded below...

On Today at 10:32am, CM=>Christopher Maloof <c_mal...@mail.jci.tju.edu> wrote:

CM> I guess no one recognizes the problem.  Next question: Has anyone 
CM> gotten this (calling action methods from FreeMarker tags) to work 
CM> successfully? Just trying to figure out whether the correct approach 
CM> is to hammer on my configuration somehow, or to file a bug.
CM> 
CM> Thanks,
CM> Chris
CM> 
CM> On 11/9/2009 10:13 AM, Christopher Maloof wrote:
CM> > I'm just starting to use FreeMarker (2.3.15) with Struts 2.1.8.  It mostly
CM> > works fine: my templates are retrieving bean information with no problem.
CM> > However, I can't figure out how to call methods defined in my action
CM> > classes.
CM> >
CM> > If my action class looks like this:
CM> >
CM> > public class MyAction extends MyActionSupport {
CM> >    public String getMyValue() {
CM> >       return "hello";
CM> >    }
CM> >    public String myMethod() {
CM> >       return "world";
CM> >    }
CM> > }
CM> >
CM> > Then these things work:
CM> > ${myValue}  (indirect access to bean getter)
CM> > ${myValue.toUpperCase()}  (method call on object)
CM> > <@s.property value="myMethod()"/>   (Struts tag calling a method)
CM> >
CM> > But these things don't:
CM> > ${myMethod()}
CM> > ${getMyValue()}  (plain method calls as described in the docs)
CM> >


Try:

${stack.findValue("getMyValue()")}
${stack.findValue("myMethod()")}

Later,
--
Haroon Rafique
<haroon.rafi...@utoronto.ca>


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

Reply via email to