This is a simple question, I must know the answer, and I am ashamed to admit that no. I submit the composite object to the JSP page:
public class MyObject {
private List<MyFoo> myFoo;
public getMyFoo();
public setMyFoo();
}
model.addAttribute("myObject", myObject);
When this enters the JSP page, I can refer to the instance of myObject model as:
${myObject}
and the list inside
${myObject.myFoo}
What I want to want is to specify the size of myFoo on my JSP output, for example:
${myObject.myFoo.size}
But of course size () is not a bean property, so a JSPException is thrown.
Is there a simple, elegant way to do this on a JSP page, or do I need to stick another attribute on the model and place the size there?
source
share