6 Replies Latest reply on Jun 8, 2006 4:19 PM by Jim Hazen

    Can I really not get the size of a list in JSF?!

    Rob Jellinghaus Novice

      So I'm mucking with the noejb example (which is basically the booking application). I've changed it from a list of hotels to a list of blog posts (yes, another blogging system, just what the world needs, I know, I know). And I tried to make this change to pages.xml:

      <page view-id="/main.xhtml" timeout="300000">View #{blogPosts.size} posts</page>

      Blew up with a "no property 'size' on ListDataModel". Sure enough, there isn't. But there's getWrappedData(). So fine, I try:
      <page view-id="/main.xhtml" timeout="300000">View #{blogPosts.wrappedData.size} posts</page>

      Now I get "no property 'size' on java.util.ArrayList"! Feh, sure, it's List.size() not List.getSize(), right? Well, what's the workaround? I try
      <page view-id="/main.xhtml" timeout="300000">View #{blogPosts.wrappedData['size']} posts</page>

      Same error. Surf some *more*, and find this page which says it can't be done at all!!! http://www.crazysquirrel.com/computing/java/jsf/list-size.jspx

      Well, the page does suggest adding getSize() on the wrapper object if any. So that brings me to the point here, which is why I'm posting here and not a JSF forum:

      Can I submit a JIRA patch to add an org.jboss.seam.jsf.ListDataModel.getSize() method, which does the obvious thing? Then at least Seam apps would be able to get the freakin' size of a simple list via JSF EL :-)

      (Also is there anywhere that documents how to generate a patch that Gavin will accept, with a Windows machine?)