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]>

Reply via email to