Solved

Mixing TagLibs

Posted on 2006-11-28
3
288 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 400 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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.

809 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