Thanks Joey, I got it working.  <bean:size.../> does the trick.

Thinh

-----Original Message-----
From: Joey Gibson [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 29, 2001 2:33 PM
To: [EMAIL PROTECTED]
Subject: Re: check for null collection


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:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


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

Reply via email to