Call Java method with parameters from Freemarker

The following FTL inscription works fine for me and calls getWidgets () on my server side JiveActionSupport object:

<#list widgets! as widget>
  -- do something with widget.sku
</#list>

However, I really need an internal list, which depends on the property of the widget, something like this:

<#list widgets! as widget>
  <#list manufacturers(widget.sku)! as manufacturer>
  -- do something with manufacturer
  </#list>
</#list>

I tried to implement server code like:

public List<Manufacturer> getManufacturers(int sku);
public List<Manufacturer> getManufacturers(String sku);

But both results: "Undefined expression producers on line 123."

How to pass parameters to methods of the current JiveActionSupport object? Thank.

+5
source share
2 answers

, , , getFoo() foo, getFoo(param) foo(param), getFoo(param). , JavaBeans; getFoo() JavaBean, getFoo(params) - .

, getManufacturers - (root), ( ) getManufacturers(param). action. .

+8

, , :

<#list action.getManufacturers("123")! as manufacturer>
  -- do something with manufacturer
</#list>

, FTL getThings() , action.getThing( "123" ) getThing (String) .

+3

All Articles