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

--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "In fact, when I die, if I don't hear 'A Love Supreme,' I'll turn back; I'll know I'm in the wrong place."
- Carlos Santana


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to