struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joey Gibson <>
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:notEqual name="mySize" value="0">
   <bean:write name="mySize"/> record(s)

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.


Sent via

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message