Invoke Java method with parameters from Freemarker
freemarker, java
Solution
The thing that possibly confused you here is that `getFoo()` can be called as `foo`, but `getFoo(param)` can't be called as `foo(param)`, only as `getFoo(param)`. But this is just how JavaBeans work; `getFoo()` defines a JavaBean property, while `getFoo(params)` doesn't.
Anyway, if `getManufacturers` is the method of the data-model (root) object, then (assuming proper object wrapping) you should be able to call it as `getManufacturers(param)`. You don't need to start it with `action.` in principle.
Problem
The following FTL markup works fine for me and calls getWidgets() in my server-side JiveActionSupport object: ``` <#list widgets! as widget> -- do something with widget.sku </#list> ``` However, I really need an inner list that depends on a property of widget, something like this: ``` <#list widgets! as widget> <#list manufacturers(widget.sku)! as manufacturer> -- do something with manufacturer </#list> </#list> ``` I have tried to implement the server-side code, as either: ``` public List<Manufacturer> getManufacturers(int sku); public List<Manufacturer> getManufacturers(String sku); ``` But both result in 'Expression manufacturers is undefined at line 123'. How can you pass parameters to methods of the current JiveActionSupport object? Thanks.