Solved

Mixing TagLibs

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
installing and using WTP plugin eclipse MARS 3 82
isEverywhere  challenge 19 64
pairstar challenge 2 42
groovy example issue 10 70
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…
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.

760 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now