Question: How would I get the length of an `ArrayList` using a JSF EL expression? 

```
#{MyBean.somelist.length}

```

does not work.

Answer: 
**Note:** This solution is better for older versions of JSTL. For versions greater then 1.1 I recommend using `fn:length(MyBean.somelist)` as suggested by [Bill James](https://stackoverflow.com/questions/206161/how-do-you-get-the-length-of-a-list-in-the-jsf-expression-language/206252#206252).

---

[This article](http://www.informit.com/articles/article.aspx?p=30946&seqNum=8) has some more detailed information, including another possible solution;

> 
> The problem is that we are trying to invoke the list's size method (which is a valid LinkedList method), but it's not a JavaBeans-compliant getter method, so the expression list.size-1 cannot be evaluated.
> 
> 
> There are two ways to address this dilemma. First, you can use the RT Core library, like this:
> 
> 
> 

```
<c_rt:out value='<%= list[list.size()-1] %>'/>

```

> 
> Second, if you want to avoid Java code in your JSP pages, you can implement a simple wrapper class that contains a list and provides access to the list's size property with a JavaBeans-compliant getter method. That bean is listed in Listing 2.25.
> 
> 
> 

The problem with c\_rt method is that you need to get the variable from request manually, because it doesn't recognize it otherwise. At this point you are putting in a lot of code for what should be built in functionality. This is a **GIANT** flaw in the EL.

I ended up using the "wrapper" method, here is the class for it;

```
public class CollectionWrapper {

    Collection collection;

    public CollectionWrapper(Collection collection) {
        this.collection = collection;
    }

    public Collection getCollection() {
        return collection;
    }

    public int getSize() {
        return collection.size();
    }
}

```

A third option that no one has mentioned yet is to put your list size into the model (assuming you are using MVC) as a separate attribute. So in your model you would have "someList" and then "someListSize". That may be simplest way to solve this issue.
You can eventually extend the EL language by using the [EL Functor](http://el-functors.sourceforge.net), which will allow you to call any Java beans methods, even with parameters...