Reputation: 12999
I have a POJO class with boolean isActive()
method.
I want to use it inside freemarker like this ${task.active?string}
but I get
Expression task.active is undefined
Is there any way to use this method or do I have to add boolean getActive()
to my POJO?
Upvotes: 2
Views: 1995
Reputation: 31112
If it's a JavaBean property (and it looks like one), then it should be available as task.active
. After all, FreeMarker just uses the standard JavaBeans API to query what properties are available. There are a few things that can cause problems here, however... One is that Chaquotay has mentioned, i.e., Boolean
instead of boolean
(the JavaBeans spec says it's not the same). Another is when task
implements the Map
interface, in which case, if the wrapper has simpleMapWrapper
set to true
, FreeMarker only exposes the map keys.
Upvotes: 2