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:
public class MyObject {
private List<MyFoo> myFoo;
public getMyFoo();
public setMyFoo();
}
// In the controller...
model.addAttribute("myObject", myObject);
When this goes into the JSP page I can address the model instance of myObject as:
${myObject}
and the list inside as
${myObject.myFoo}
What I want to do is list the size of myFoo on my JSP output, like so:
${myObject.myFoo.size}
But of course size() is not a bean property, so a JSPException is thrown.
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?