Problem
How to get the length of a Collection in the JSF expression language?
Solution
There are two ways to get the length of a Collection i.e. List, Set, etc in the JSF expression language
a) Define a method in the Bean
In your bean declare a method to return the length of a collection
@Named("MyBean ")
@SessionScoped
public class MyBean {
private List list;
.
.
.
public int getCollectionLength() {
return list.size();
}
}
Comments
Post a Comment