<logic:equal/> looks for an attribute with the given "name" and compares for 
equality with the given "value". <bean:define/> not only creates a scripting 
variable but also puts an attribute with the same name. Here you only modify 
the value of the scripting variable and not the "attribute" value, which is 
what the <logic:equal/> is going to look for which is not modified from the 
initial "true" value and so you would end up executing that block of code 
always.

You could do any of the following:
Use <bean:size> and compare the size to 0 using <logic:equal/> to check if 
the collection is empty or not
Use <logic:empty/> to check the emptiness instead of the <logic:equal/>

On 9/15/05, Filipe Pomar <[EMAIL PROTECTED]> wrote:
> 
> Guys, I have the following pseudo-code:
> 
> <bean:define id="isEmpty" value="true" type="java.lang.String"/>
> 
> // begin: some iteration
> <%isEmpty="false";%>
> // end: some iteration
> 
> 
> ... then I want to test if isEmpty is true. The body of following code
> always get executed:
> <logic:equal name="isEmpty" value="true">
> // some code that always run
> </logic:equal>
> 
> 
> ... though, the behavior I expected to get is seen only when using
> scriptlets, as follow:
> <% if ("true".equals(isEmpty)) { %>
> // works fine
> <% } %>
> 
> 
> Any ideas on why this happens are much appreciated.
> 
> Regards,
> Filipe
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

Reply via email to