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.
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.
In general, it looks as if you need to do this as follows:
<#list action.getManufacturers("123")! as manufacturer>
-- do something with manufacturer
</#list>
In particular, while you can use things in FTL to invoke the server-side method getThings(), you need to use action.getThing("123") to invoke the server-side method getThing(String).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With