I think there may be a few issues here ...

First of all, notEmpty, I believe, checks for whether or not a String 
value is set for a specific bean property (checks for null or empty 
String). So I don't think you can use if for a collection as a whole. The 
notPresent tag may be better suited to this, although that may just check 
to see if the collection is in existence, not necessarily populated with 
values. In other words, the collection can be empty, but it is still 
present. I think.

Have you tried using your collection as the name for the bean, and using 
some field in the collection as the property? This brings it more down to 
the level of what notEmpty is used for. 

All my properties are set from my formbean within the action that loads 
the jsp. So in my case, I have a collection object in my form, with its 
getters and setters, and the action does the ... 
myform.setMyCollection(someCollectionFromSomewhere); ... then, if the 
collection is null, the notPresent tag in the jsp will do whatever you 
need it to do. 

You can use the <bean:define> tags to set your page scoped collection to a 
variable which will be useable within your jsp, but I am not sure if that 
is what you are looking for?

Susan Bradeen

On 03/31/2003 10:02:44 AM "Sloan Seaman" wrote:

> But what isf the collection is directly inside of the page scope and not 
a
> value within a bean that is inside of the page scope?
> 
> The name attribute is to get the value from the bean defined in the 
scope by
> the property attribute.  What if the bean itself is the collection?
> 
> Or, to put a spin on it, how would you check for the existence of a 
bean?
> 
> --
> Sloan
> 
> ----- Original Message -----
> From: "Susan Bradeen" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Monday, March 31, 2003 9:26 AM
> Subject: Re: logic:notEmpty
> 
> 
> > Oops, sorry about that ... I was thinking of the wrong tag!
> >
> > Yes, I use notEmpty, and use both name and property attributes.
> >
> > Susan Bradeen
> >
> > On 03/31/2003 09:19:18 AM "Susan Bradeen" wrote:
> >
> > > I have used this tag, but I usually reference the name (formbean) 
and
> > > property together. At the very least, you *must* include the value
> > > attribute to make the logic comparison with your property value. 
Even if
> > > the tag picked up your property, what it is supposed to be comparing 
it
> > to
> > > see if it is "notEqual"?
> > >
> > > Hope this helps,
> > >
> > > Susan Bradeen
> > >
> > > On 03/31/2003 09:01:50 AM "Sloan Seaman" wrote:
> > >
> > > > I want to use the logic:notEmpty tag to test if a collection I 
have is
> > > empty or
> > > > not.
> > > >
> > > > The Collection is in the pageContext under the variable name
> > > barcodeList.
> > > >
> > > > The Docs for notEmpty say that name, property, and scope are not
> > > required but
> > > > if I use the property attribute it complains that I need the name. 
 If
> > I
> > > use
> > > > name, it compains that I need property.
> > > >
> > > > I would think I should just be able to do:
> > > > <logic:notEmpty property="barcodeList">
> > > > stuff
> > > > </logic:notEmpty>
> > > >
> > > > but this doesn't seem to work.
> > > >
> > > > What is the correct way?
> > > >
> > > > Thanks!
> > > >
> > > > --
> > > > Sloan
> > > >
> > > >
> > > >
> > 
________________________________________________________________________
> > > > This email has been scanned for all viruses by the MessageLabs 
SkyScan
> > > > service. For more information on a proactive anti-virus service
> > working
> > > > around the clock, around the globe, visit
> > >
> >
> 
http://www.messagelabs.com__________________________________________________
> ____
> > > __________________
> > >
> > > 
---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail: [EMAIL PROTECTED]
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 
> ________________________________________________________________________
> This email has been scanned for all viruses by the MessageLabs SkyScan
> service. For more information on a proactive anti-virus service working
> around the clock, around the globe, visit http://www.messagelabs.com
> ________________________________________________________________________
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

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

Reply via email to