Thanks for pointing out, you are right Chris
I did not include logic tag lib, I should have thought of this before.

Now, I tried other ways as suggested by other members of the forum (at least
now I get Exception :))

(a)
<logic:notPresent property='<mytaglib:getvalue name="cost" />'>
FREE
</logic:notPresent>

javax.servlet.ServletException: No selector attribute
(cookie/header/name/parameter) was specified
        at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:471)

(b)
<logic:notPresent property="<mytaglib:getvalue name="cost" />">
FREE
</logic:notPresent>

org.apache.jasper.compiler.ParseException: /test.jsp(66,62) Attribute name
has no value

So Chris, looks like you are right here as well, nested tags do not
work......
It would seem to me that the only option that I have now is to use a
scripting variable in my tag lib, and use that scripting variable in the JSP
to print FREE based on the value of that scripting variable.

Are there any other elegant ways of doing this ??????

Many Thanks,
Tejas



-----Original Message-----
From: Bartley, Chris P [PCS] [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 20, 2002 6:59 PM
To: 'Struts Users Mailing List'
Subject: RE: Logic tag


This sort of approach...

   <logic:isPresent property="<mytaglib:getvalue name="cost" />">
      FREE
   </logic:isPresent>

...will not work because you can't nest XML tags like that (a tag within an
attribute).  Most JSP compilers blow up when they see stuff like that.

Since yours apparently didn't AND since you said that "FREE" is always
getting printed, i'm willing to bet that you forgot to import the logic
and/or mytaglib tag libraries.

Tip: whenever i see weird behavior like this, the first thing i do is check
the source of the resulting HTML.  If there are JSP tags in there then i
know for sure that i forgot a taglib import (a good IDE should highlight
errors like that...<plug>my IDE of choice is IntelliJ IDEA</plug>).

chris

> -----Original Message-----
> From: Tejas Bavishi [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 20, 2002 12:31 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Logic tag
> 
> 
> Hi again,
> Thanks for the pointer. 
> I tried the following two variations of codes, however, the 
> results were
> same as per the earlier email.
> 
> <logic:isPresent property="<mytaglib:getvalue name="cost" />">
> FREE
> </logic:isPresent>
> 
> <logic:notPresent property="<mytaglib:getvalue name="cost" />">
> FREE
> </logic:notPresent>
> 
> The getValue tag returns a String object. 
> 
> Is something wrong with this code ? 
> Also, one more doubt is if the property attribute that I have 
> used in the
> above code for isPresent tag, is it the correct use ? As the 
> value I want to
> check comes from my own tag library.
> 
> If I cannot achieve this using the logic taglib, is there  
> another elegant
> way to do this ?
> 
> Many Thanks,
> Tejas
> 
> 
> 
> -----Original Message-----
> From: Galbreath, Mark [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 20, 2002 5:49 PM
> To: 'Struts Users Mailing List'
> Subject: RE: Logic tag
> 
> 
> Use <logic:isPresent> instead.
> 
> Mark
> 
> -----Original Message-----
> From: Tejas Bavishi [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 20, 2002 11: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