It's not a secret anymore!*
The moose likes Struts and the fly likes how to apply continue statement in struts logic:iterate tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to apply continue statement in struts logic:iterate tag" Watch "how to apply continue statement in struts logic:iterate tag" New topic
Author

how to apply continue statement in struts logic:iterate tag

Khushwinder Chahal
Ranch Hand

Joined: Oct 03, 2007
Posts: 128
Hi Friends

Does anybody has any idea to apply continue statement in struts <logic:iterate> tag.
I need it in my application.

Thank You In Advance.


Khushwinder
Ranjit Gopinathan
Ranch Hand

Joined: Jul 03, 2007
Posts: 46
Assuming that the "continue" is used in conjunction with a comparison

<logic:iterate>
<logic:equal>
This part will only be executed if the condition is true
</logic:equal>
else it will continue.
</logic:iterate>

You may use a logic tag ( equal, notequal, present ..) for the comparison.
Will this serve the purpose??
[ October 25, 2007: Message edited by: Ranjit Gopinathan ]
Khushwinder Chahal
Ranch Hand

Joined: Oct 03, 2007
Posts: 128
Thanks For Reply Sir

But i think i need to explain my problem a little bit more.
Actually i am using nested <logic:iterate>.
Now what i want is that when the inner loop prints some value it should break it and continue with the next outer loop.
Here loops means logic iterate.
So what i should do now.
I need it very urgently.
Please help me.
Ranjit Gopinathan
Ranch Hand

Joined: Jul 03, 2007
Posts: 46
Please post the code. That way it will be easy for us to find the solution.

And call me Ranjit

Cheers
Khushwinder Chahal
Ranch Hand

Joined: Oct 03, 2007
Posts: 128
okay Ranjit
Here is my code


I need to shift to outer loop when one of the conditions between logic equal or logic not equal occurs.
Ranjit Gopinathan
Ranch Hand

Joined: Jul 03, 2007
Posts: 46
If i understand the logic correctly , the second array list ( inner one ) need to be iterated only once, whatever be its size.Because equal or not equal the flow must exit that inner list.

In that case, instead of the array list, a simple bean can be used right?

Or else write a method in action form which will return the first object of the array List. get that bean and process it.
Dom Lassy
Ranch Hand

Joined: May 05, 2006
Posts: 181
You should do all of that logic in your action class. It is a lot easier to do there and it is a lot easier to maintain.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to apply continue statement in struts logic:iterate tag
 
Similar Threads
logic:iterate functionality with jsf
Difference between [c:forEach] and [logic:iterate]
code too large for try statement
submitting dynamic text boxes to ActionForm
How to iterate multiple list in an object?