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:tdoan@twjconsulting.com]
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:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>
--
To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>
|