You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ignacio de Córdoba <ic...@skios.es> on 2009/04/08 19:34:04 UTC
Invoking a method in the Action from a FreeMarker template
Hi there,
I am trying to invoke a method in a struts2 action from a FreeMarker
template. To do this, I "put" the action as an object named "action" and
then I reference it, for example, as:
<#list action.sortedFields as field>
(Sorted fields is a method: getSortedFields())
this works OK, but I cannot invoke methods with parameters... not just
getters. For example I try:
${action.getTheFieldEntry(7)}
I get
freemarker.core.InvalidReferenceException: Expression
action.getTheFieldEntry(7) is undefined on line 6, column 57 in
formprocessor/formEntryMail.ftl.
(getTheFieldEntry has the following signature:
public String getTheFieldEntry(int fieldId){...}
)
Is it only possible to invoke object getters and setters? I've read
Fremarker docs and regular methods can be invoked.
Thanks for any help,
Ignacio
--
View this message in context: http://www.nabble.com/Invoking-a-method-in-the-Action-from-a-FreeMarker-template-tp22955789p22955789.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org