Hey Joe that length function looks like just what I wanted....I didn't
want to do scriplets because of the possibility of a NPE if the session
timed out and the list wasn't in the session, I want something that
gracefully handles the missing item and I thought a custom taglib might
be overkill.
Thanks for your suggestions!
Joe Germuska wrote:
At 5:15 PM -0700 6/5/04, Riyad Kalla wrote:
I'm trying to do something like:
<logic:greaterThan name="userList" property="size" value="20">
<!-- Display paging controls -->
</logic:greaterThan>
but I'm obviously getting an exception on size because it doesn't
follow JB naming conventions. How do I call this method? Do I NEED to
use EL for this?
One of the unfortunate shortcomings of the Collections APIs is the
lack of a bean-convention-named method to access the length of the list.
If you put userList into the request before forwarding to the JSP, you
could also set another request attribute with the size value; or you
could put the list in a simple wrapper:
public class MyListWrapper {
private List list;
public MyListWrapper(List list) { this.list = list; }
public int getSize() { return this.list.size(); }
public List getList() { return this.list; }
}
If you are using JSTL 1.1, you could use the "length" function.
http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/fn/length.fn.html
Of course, you could use scriptlets too.
Joe
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]