title: get the value of a List.size() in a JSP page?
body: <p>This is a simple question, I should know the answer and I'm ashamed to admit I don't.   I am sending a compound object to my JSP page:</p>
  
  <pre><code>public class MyObject {
      private List&lt;MyFoo&gt; myFoo;
      public getMyFoo();
      public setMyFoo();
  }
  
  // In the controller...
  model.addAttribute("myObject", myObject);
  </code></pre>
  
  <p>When this goes into the JSP page I can address the model instance of myObject as:</p>
  
  <pre><code>${myObject}
  </code></pre>
  
  <p>and the list inside as </p>
  
  <pre><code>${myObject.myFoo}
  </code></pre>
  
  <p>What I <strong>want</strong> to do is list the size of myFoo on my JSP output, like so:</p>
  
  <pre><code>${myObject.myFoo.size}
  </code></pre>
  
  <p>But of course size() is not a bean property, so a JSPException is thrown.</p>
  
  <p>Is there a simple, elegant way of doing this in the JSP page or do I need to stick another attribute on the model and put the size in there?</p>