struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Mitchell" <jmitch...@apache.org>
Subject RE: logic:empty and logicnotEmpty with a Collection (again)
Date Wed, 19 Feb 2003 16:02:23 GMT
Oops, hold that thought.  I didn't read my results correctly.

You're right, my test.jsp showed both (which is wrong).
I'll take a closer look at this.


--
James Mitchell
Software Engineer/Struts Evangelist
http://www.open-tools.org/

"The man who does not read good books has no advantage over the man who
cannot read them."
	- Mark Twain (1835-1910)



> -----Original Message-----
> From: James Mitchell [mailto:jmitchell@apache.org] On Behalf 
> Of James Mitchell
> Sent: Wednesday, February 19, 2003 10:56 AM
> To: 'Struts Users Mailing List'
> Subject: RE: logic:empty and logicnotEmpty with a Collection (again)
> 
> 
> That doesn't seem right.  What version are you using?
> 
> I recently finished cactus tests on the logic tags, and I test exactly
> what you've described without failures.
> 
> 
> In fact, I just tried this in a test.jsp:
> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
> <%
>   java.util.Map emptyMap = new java.util.HashMap();
>   pageContext.setAttribute("emptyMap", emptyMap);
> %>
>   <logic:empty name="emptyMap">emptyMap empty</logic:empty><br>
>   <logic:notEmpty name="emptyMap">emptyMap not
> empty</logic:notEmpty><br>
> 
> 
> 
> ....works fine.
> 
> You probably forgot to add the taglib declaration:
>   <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
> 
> If you did not do this, then you will see exactly what you've 
> described.
> 
> 
> 
> --
> James Mitchell
> Software Engineer/Struts Evangelist
> http://www.open-tools.org/
> 
> "The man who does not read good books has no advantage over 
> the man who
> cannot read them."
> 	- Mark Twain (1835-1910)
> 
> 
> 
> 
> 
> 
> 
> > -----Original Message-----
> > From: Steffen.Uhlig@gmx.net [mailto:Steffen.Uhlig@gmx.net] 
> > Sent: Wednesday, February 19, 2003 3:11 AM
> > To: struts-user@jakarta.apache.org
> > Subject: logic:empty and logicnotEmpty with a Collection (again)
> > 
> > 
> > Hi,
> > 
> > I found some behaviour of the logic:notEmpty tag which I think is
> > inconsistent.
> > 
> > Reading the documentation, I think it should call a 
> > collection's isEmpty()
> > method. It works as expected with a bean of type List, but it 
> > doesn't work
> > with a Map.
> > 
> > Testcase:
> > 
> > If emptyList was built with
> > 
> >   List emptyList = new ArrayList();
> > 
> > the following fragment correctly states only "emptyList empty":
> > 
> >   <logic:empty name="emptyList">emptyList empty</logic:empty><br>
> >   <logic:notEmpty name="emptyList">emptyList not 
> > empty</logic:notEmpty><br>
> > 
> > But if I change from emtpyList to
> > 
> >   Map emptyMap = new HashMap();
> > 
> > and test it with
> > 
> >   <logic:empty name="emptyMap">emptyMap empty</logic:empty><br>
> >   <logic:notEmpty name="emptyMap">emptyMap not 
> > empty</logic:notEmpty><br>
> > 
> > I get
> > 
> >   emptyMap not empty
> >   nonemptyMap not empty
> > 
> > instead of just "emptyMap empty". Both (mutually exclusive) 
> > statements seem
> > to evaluate to true.
> > 
> > So, is this a misunderstanding from my side or a bug in the 
> > implementation?
> > 
> > TIA
> > 
> > Steffen
> > 
> > 
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> > 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message