Pardon me for jumping into this thread...

Once you use bean:define, is it possible to change the value?
I wanted to use bean:define like this:

    <bean:define id="resultsEmpty" value="true"/>
    <logic:iterate id="code" name="myForm" property="codeList" type="Foo">
        <bean:define id="resultsEmpty" value="false"/>
        <bean:write name="code" property="desc"/>
    </logic:iterate>
    <logic:equal property="resultsEmpty" value="true">
        No records found.
    </logic:equal>

This didn't work.  It barfed on the second bean:define, but I have a feeling
the logic:equal won't work either.

Bryan

----- Original Message -----
From: "Martin Cooper" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Friday, September 20, 2002 12:52 PM
Subject: RE: Logic tag


You'll need to do this:

  <bean:define id="cost"><<mytaglib:getvalue name="cost" /></bean:define>
  <logic:empty name="cost">
    FREE
  </logic:empty>
  <logic:notEmpty name="cost">
    <bean:write name="cost"/>
  </logic:notEmpty>

To test if a value is empty, you need to have something to test against.
Since your tag is just writing out the value, you need to capture that value
first, by defining a bean for it. Since the value of your output will never
be null, you cannot use <logic:present> to check it; you need to use
<logic:empty> instead.

--
Martin Cooper


> -----Original Message-----
> From: Tejas Bavishi [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 20, 2002 8:55 AM
> To: '[EMAIL PROTECTED]'
> Subject: Logic tag
>
>
> Hi,
>
> I have a question on using logic tags.
>
> In the following example, mytaglib is the tag library
> developed by me. I am
> printing the value returned by the following tag on the JSP page.
>
> <TD>
> <mytaglib:getvalue name="cost" />
> </TD>
>
>
> Now, I want to check that if the value returned by mytag is
> "", then I want
> to print FREE. I tried the following code.
>
> <logic:equal property="<mytaglib:getvalue name="cost" />" value="" >
> FREE
> </logic:equal>
>
>
> But the text FREE is printed regardless of the value returned
> by mytag.
> Obviously, I am doing something wrong or my approach is not correct.
> Can someone please guide me on this.
>
> Many Thanks,
> Tejas
>
>
>
>
> --
> 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]>




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

Reply via email to