struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joey Gibson <jt...@bravepoint.com>
Subject Re: check for null collection
Date Thu, 01 Jan 1970 00:00:00 GMT
If the collection is truly null, then <logic:present> will be false so you won't get
into the tag body. To see if the collection is just an empty collection:

Inside your <logic:present> you can use a combo of tags from the bean and logic taglibs:

<bean:size id="mySize" name="myArray"/>
<logic:equal name="mySize" value="0">
   No records.
</logic:equal>
<logic:notEqual name="mySize" value="0">
   <bean:write name="mySize"/> record(s)
</logic:notEqual>

And you don't have to do the <bean:define> since most of the tags will be able to find
the collection in whichever scope it is in. In my sample program that I wrote to test this
information, I created a List and shoved it into the request. I never mentioned which scope
it is in, though you can specify.

Joey

--
Sent via jApache.org

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message