Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Mixing TagLibs

Posted on 2006-11-28
3
Medium Priority
?
296 Views
Last Modified: 2013-11-24
Using the nested library I'm "3 nests down".   I have a one of my variables is a string that contains multiple words.  

example "apple|pear|bananna"   I need some logic activated by the word "apple".    

<nested:iterate property="nest1" >
       <nested:iterate property="nest2" >
             <nested:iterate property="nest3" >
                     <nested:write property="myNest3String" />
                      prints:  "apple|pear|bananna"
                      here is where I want my logic to trigger on the word "apple" as part of myNest3String.
             </nested:iterate>
       </nested:iterate>
</nested:iterate>



What is the proper way to do this?    
I am not finding a <c:when><c:if> like statement in the nested library.  
Is there a problem mixing taglibs?
Am I allowed start using a new taglib 3 nests down?    
Or do I have a scope problem?  

example?
0
Comment
Question by:tmonteit
  • 2
3 Comments
 
LVL 29

Expert Comment

by:bloodredsun
ID: 18035890
There shouldn't be a problem mixing tags.

I don't like the nested tags and always prefer to use the JSTL equivalents but in this case you should be able to use the <logic:equals> struts tag if you can't use the <c:if> tag (I don't know about scope which may be an issue with <c:if>).
.
..
...
 <nested:write property="myNest3String" />
     <logic:equals property="myNest3String" value="apple">Here be apples, lets make cider!</logic equals>
  </nested:iterate>
...
..
.
0
 

Author Comment

by:tmonteit
ID: 18039278
I think I've got it.   What's the difference between 'contains' vs. 'equals'?

I noticed you used the 'logic:equals' function.   If myNest3String is "apple juice and orange juice", will your method still return true?

Is there a 'contains' equivalent?
0
 
LVL 29

Accepted Solution

by:
bloodredsun earned 1600 total points
ID: 18043887
>>What's the difference between 'contains' vs. 'equals'?

There is no 'contains' but there is a 'match'. The match function returns true if the value is a substring of the requested variable, and the equals only returns true if the 2 variables are exactly the same. I don't know why it's not called contains as that what it equates to!

>>If myNest3String is "apple juice and orange juice", will your method still return true?

No as it's not an exact match for the string "apple"

>>Is there a 'contains' equivalent?

Yep. It's match as described above.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question