How would I get the length of an ArrayList
using a JSF EL expression?
#{MyBean.somelist.length}
does not work.
eljavajsfjspjstl
How would I get the length of an ArrayList
using a JSF EL expression?
#{MyBean.somelist.length}
does not work.
Best Answer
Yes, since some genius in the Java API creation committee decided that, even though certain classes have
size()
members orlength
attributes, they won't implementgetSize()
orgetLength()
which JSF and most other standards require, you can't do what you want.There's a couple ways to do this.
One: add a function to your Bean that returns the length:
Two: If you're using Facelets (Oh, God, why aren't you using Facelets!), you can add the fn namespace and use the length function