Yes, since some genius in the Java API creation committee decided that, even though certain classes have size()
members or length
attributes, they won't implement getSize()
or getLength()
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:
In class MyBean:
public int getSomelistLength() { return this.somelist.length; }
In your JSF page:
#{MyBean.somelistLength}
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
In JSF page:
#{ fn:length(MyBean.somelist) }
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…