• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to break from the struts logic:iterate tag ?

 
pratibha patel
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

In JSP I am using logic:iterate tag to iterate my collection. In scriptlet I have if and else statements, when certain condition met, I want to break form the loop.
something like this example:

Now I want to break after else conditon from iterate loop. So if I put break, it throws an exception says Code is unreachable.
Example->

Is there any way to break from iterate tag ?

Please do the needful.
Thanks.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.
 
getshijos joseph
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As far as I know , struts doesn't support break from iterate. It expects a collection to be populated by Action class and view will only render the prepopulated collection. All those logic to filter the collection should be done within the action class.
 
Karthik Jayachandran
Ranch Hand
Posts: 91
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You can use logic:equal/logic:notEqual tags inside logic:iterate tag
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic