• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how to break from logic:iterate tag

 
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have this code


Which I want the value Y and N to be displayed according to the value conditioned in <logic:equal> however when i run the website, it displayed
both Y and N.
Is there any struts tag library that enable to break from <loop:iteration> cause I've tried to put <%break;%> inside it but it result and error
Please give me some feedbacks, i'm in the middle of deadline
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, it is not possible to break from a <logic:iterate> loop.

Since you already have a lot of scriptlet code in this loop, I'd recommend that you dispense with the <logic:iterate> tags and <logic:equals> tags entirely and just write java code. Then you will have no problem breaking from the loop if you need to.

just get the variable from the request like this:

java.util.List fromKPI = (java.util.List)request.getAttribute("ListSmkKpi");

Then just iterate through the list as you would in any Java code.
 
pingkan paula
Ranch Hand
Posts: 117
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I use java code as shown below

However, when i run the web it never reach condition of value "Y", it always
entering the condition of value "N"
The result of the debug is always "false" but when i checked the database it has several "Y" value
How am i going to solve this?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems pretty clear to me that if you find that the contents ListSmkKpi does not match what you know to be in the database, whatever process populated ListSmkKpi did not do so correctly. You'd do well to look at that process.
 
reply
    Bookmark Topic Watch Topic
  • New Topic