Maps are treated differently than regular JavaBeans so that you can't access
bean properties. For example, every object has a bean property called "class",
but you won't get any output if you try ${map.class}. It's even more fun to try
and get at a map's "empty" property ;-). If all you're concerned with is
testing whether a map is empty or not, you can use ${not empty map}. If you
really need the size of the map, you could try the Unstandard taglib:http://jakarta.apache.org/taglibs/sandbox/doc/unstandard-doc/intro.html Or do something like create a wrapper bean for collections that exposes a "size" property and delegates to the wrapped collection. Quoting Roy Benjamin <[EMAIL PROTECTED]>: > I am displaying the values in a TreeMap using forEach tag. > However, I only want to do this if the map is not empty. > I also need to display the count of entries in the map at > the top of the page. > > In TreeMap, size/size() is not a Bean Property (no?) so I tried > in-line subclassing to expose the property: > > <% > TreeMap treeMap = new TreeMap() { > public int getSize(){return size();} > }; > pageContext.setAttribute("TableRows",treeMap); > %> > > now much later I try: > > <TD> > Search Results: <c:out value="${TableRows.size}"/> found. > </TD> > > I could just count things as they are added to the map > over a series of SQL queries, but it seemed to me this > was the better solution.. only the EL expression is null. > > I'm sure I'm doing something wrong.... > > Thanks > > Roy -- Kris Schneider <mailto:[EMAIL PROTECTED]> D.O.Tech <http://www.dotech.com/> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
