How do you call List.size() from a JSF 2.0 Facelets Template?

jsight picture jsight · Aug 26, 2009 · Viewed 26.2k times · Source

What is the syntax for calling list.size() in a JSF 2.0 Facelets template (eg, using an h:outputText element)?

Answer

harto picture harto · Sep 4, 2009

How about this:

<h:outputText value="#{fn:length(someBean.someList)}" />

You'll need to reference the functions taglib in your JSF page (URI: http://java.sun.com/jsp/jstl/functions).