The way I do it is to create a variable using the bean:size tag that
represents the size of the collection ...
Then I check if that value is 0 as follows ... (in addition you might want
to also check if the collection is present as you are doing)

                                <bean:size id="numReports"
name="generalReports"/>
                                <logic:equal name="numReports" value="0">
                                        <p>No reports available.</p>
                                </logic:equal>

-----Original Message-----
From: Thinh Doan [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 28, 2001 2:53 PM
To: Struts-User
Subject: check for null collection


I've defined the following collection but don't know how to use the logic
tag to check if it contains no data to display appropriate message:

<logic:present name="MEMBERS" scope="request">
<bean:define id="myArray" name="MEMBERS" type="java.util.TreeSet"
scope="request"/>

        <logic:iterate id="member" name="myArray"
type="com.mycompany.Member">
        ...
        </logic:iterate>

    <some logic to check for null "myArray">
             No members
    </logic:???>

</logic:present>

Thanks in advance,

Thinh


--
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