File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to break from logic:iterate tag

 
pingkan paula
Ranch Hand
Posts: 117
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic