How to break foreach inner loop in the jstl tags

break a inner foreach loop in jstl

Unfortunately you can't. You have to design a break yourself - like set an extra condition based on a boolean.

Similar Messages

  • Need help with nested loop (c:forEach) tags. Can I break from inner loop?

    Hi all, I have this annoying problem and I am looking for any suggestions.
    I have 2 select boxes. One is for all available users, and second - for selected users (designated as admins). The list of all users is available in a collection (2 properties userId and userName displayed in the code below). The list of admins contains only userId (as strings).
    I have no problem with populating selected users (admins) list, reusing pretty much the same logic below, but I cannot find a way to break out from the nested loop once the match is found, to avoid repetitions leading to incorrect display of results.
    <select name=available>
    <c:forEach items="${users}" var="user" varStatus="outer">
        <c:forEach items="${adminIds}" var="adminId" varStatus="inner">
            <c:if test="${user.userId!=adminId">
                 <option value="<c:out value="${user.userId}" />"><c:out value="${user.userFullName}"/></option>
            </c:if>
        </c:forEach>
    </c:forEach>
    </select>
    <select name=selected>
    <c:forEach items="${users}" var="user" varStatus="outer">
        <c:forEach items="${adminIds}" var="adminId" varStatus="inner">
            <c:if test="${user.userId==adminId">
                 <option value="<c:out value="${user.userId}" />"><c:out value="${user.userFullName}"/></option>
            </c:if>
        </c:forEach>
    </c:forEach>
    </select>Can anyone help, please? I am also restricted to JSP 1.2

    Double post: http://forum.java.sun.com/thread.jspa?threadID=707950&tstart=0

  • How can I start a loop before the DAQ Assistand outputs a value?

    Hi everybody,
    I created a VI (See attachment) to Measure the speed of a turning wheel. (A optical detector outputs pulses which are proportional to the speed) The DAQ Assistant measures the frequency and the values are written to a log file. To log every 100 ms the value into the table, there is a while loop with should be executet 10 times a second.
    The first question:
    I want to start measurement as soon as I press "RUN". In fact, my VI first begins to run and log data when the wheel turns and the frequency is not "0". But I want to log data too, if the speed is "0". How can I programm that in Labview?
    The second problem:
    Labview writes not continuely the values: Sometimes 7 values a second, sometimes 11 values.... (I can see that because i log the time too). But if the programm runs for some seconds its getting better and better.
    How can I force Labview to run the loop exactly tacted? Is my Computer too slow? Or is my method to log continuely data simply wrong? I am relative new in Labview and would be thankful in getting help.
    Markus
    Attachments:
    Measure Frequency and Log data.vi ‏63 KB

    I would say right off hand from what you describe that the issue is not related to computer speed, but choice of operating system. Windows is not a deterministic operating system - this means you can't count on how long it will take to do anything.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • How to use Direct Access URL in the FORM tag

    I want to substitute the pageid url (/servlet/page?_pageid=161&_dad=portal30&_schema=PORTAL30) with the direct access urls (pls/portal30/url/page/my_page) to address the pageid conflict between development server and production server.
    It works perfectly fine in the redirection code such as:
    self.location.href="/pls/portal30/url/page/next_page". But I got "Page can not be found" error message when I use it in the <FORM> tag:
    <FORM ACTION="/pls/portal30/url/page/next_page" METHOD="POST" NAME="my_form">
    Does anyone out there know how to use the direct access url inside the <FORM> tag? I am trying not to write a bunch of code just to retrieve and insert the pageid at the run time.
    Thanks in advance.
    Arthur

    Use condition. If you are validating a record, just out the desired check in the condition field for that specific item.
    Thanks
    Nagamohan

  • How use c:forEach to loop over a String[][]

    Hello,
    Is there anyone that can tell me how to use the c:forEach tag to loop over a double String[][]? I can find examples for resultsets etc....but whatever I try with my String[][], I never can get the results on the screen.
    Thanx,
    debeumers

    You need to set up a double c:forEach loop.
    ie
    <%
    // initialisation of string[][]
    String[][] sValues = new String[5][5];
    for (int i=0; i<sValues.length; i++){
      for (int j=0; j<sValues.length; j++){
         sValues[i][j] = "" + (i + j);
    pageContext.setAttribute("arrayValues", sValues);
    %>
    // And now to test print out the values
    <c:forEach var="row" items="${arrayValues}">
    <c:forEach var="col" items="${row}">
    <c:out value="${col}"/>
    </c:forEach>
    <br>
    </c:forEach>
    Hope this helps
    Cheers, evnafets

  • How to overwrite an inner query in the select clause

    Hello,
    I have a queryof this form:
    SELECT t1.ID,
               t1.column2,
               (SELECT SUM (t2.column2)
                    FROM table2 t2
                  WHERE t2 = t.ID
                       AND t2.column1 IN (SELECT ..... FROM table3 t3 WHERE t3.column1 = t1.column3 ........)
        FROM table1 t1At the stage where I select from table3 I do not see the columns of table1. In other words:
      t3.column1 = t1.column3will NOT work.
    The version of the database is 10.2.0.4.
    How could I rewrite this piece of code in order to surround the problem?
    I cannot join table3 with table1 in the outermost query, because the structure of this database is such that it would not work for me.
    I know that most of you would say, change the DB structure, but anyway, any ideas? :)
    Besides, is the same restriction for inner queries applicable in Oracle 11g2?
    Thanks

    user13080027 wrote:
    Hi
    I mean I receive the error ORA-00904-"t1.column3" invalid identifier.Something does not add up here. You said earlier
    I cannot join table3 with table1 in the outermost query, because the structure of this database is such that it would not work for me.Why can't you rewrite your query something like follows:
    SELECT t1.ID,
               t1.column2,
               (SELECT SUM (t2.column2)
                    FROM table2 t2
                  WHERE t2 = t.ID
                       AND t2.column1 = t3.column3
        FROM table1 t1, table3 t3
    WHERE t3.column1 = t1.column3p.s. I am not saying this is the exact query you need but then you don't provide any details requested. ;)

  • Help on how to make an infinite loop with the same space on all images

    HI:
    I made a movie clip with infinite  loop in which there are images that move from right to left something simple like a marquee, and each image has a blank space between  them, but between last and first image there is a more space, how I can do to  make all images have an equal space between each one and that the motion never stops.

    Thanks for your time and answers my friend, but I'm still not be able to achieve what I want, I forgot to tell that I'm doing this by layers, let's say, I have 5 images, (in fact I have like 50 images converted to movie clip symbols) each image has it's own layer, layer 1, layer 2, layer 3, layer 4, layer 5, then I put a 200 frame motion tween on all layers at 30 fps, then I arranged layer 1 on the first frame to the frame 200, the second layer from frame 50 to frame 250, third layer from frame 100 to frame 300, fourth layer from frame 150 to frame 350, and fifth layer from frame 200 to frame 400, by this I mean I put a 50 frame of space on each image but if you can see, the last image has a duration from frame 200 to frame 400, and there's nothing on frame 250 where it is supposed to be another image to match the same blank space of all the others, the movie clip restarts on the frame 400, and there's a 150 frames of blank space between the last image and the first image, I put the gotoandplay on the frame 250, but it abruptly restarts the movie.
    Is there another way to do this ?
    Am I doing something wrong ?
    Please I really really need help on this.
    Thanks

  • How can I extract value based on the specific tag?

    Hello,
    I have a sample xml file:
    <?xml version="1.0" encoding="UTF-8"?>
    <listings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://local.google.com/local_feed.xsd">
    <language>en</language>
    <datum>WGS84</datum>
    <listing>
    <id>242238</id>
    <name>Baskin-Robbins</name>
    <date month="5" day="13" year="2010" />
    <content>
    <text type="menu">
    <link>http://www.allmenus.com/ca/san-fernando-valley/242238-baskin-robbins/menu/</link>
    <title>Baskin-Robbins</title>
    <author>Allmenus.com</author>
    <body>View this menu online at Allmenus.com</body>
    </text>
    <attributes>
    <link>http://www.allmenus.com/ca/san-fernando-valley/242238-baskin-robbins/menu/</link>
    <title>Baskin-Robbins</title>
    <attr name="Average Entree">$41.95</attr>
    <attr name="Cuisine">Ice Cream</attr>
    <attr name="Cuisine">American</attr>
    <attr name="Payment accepted">Cash</attr>
    <attr name="Feature">Cheap Eats</attr>
    <attr name="Feature">Kid Friendly</attr>
    <attr name="Feature">Fast Food</attr>
    <date month="5" day="13" year="2010" />
    </attributes>
    </content>
    </listing>
    <listing>
    <id>243810</id>
    <name>Villa Maria Pizzeria &amp; Restaurant</name>
    <date month="5" day="13" year="2010" />
    <content>
    <text type="menu">
    <link>http://www.allmenus.com/ny/nassau-county/243810-villa-maria-pizzeria--restaurant/menu/</link>
    <title>Villa Maria Pizzeria &amp; Restaurant</title>
    <author>Allmenus.com</author>
    <body>View this menu online at Allmenus.com</body>
    </text>
    <attributes>
    <link>http://www.allmenus.com/ny/nassau-county/243810-villa-maria-pizzeria--restaurant/menu/</link>
    <title>Villa Maria Pizzeria &amp; Restaurant</title>
    <attr name="Hours">Sun 12pm-9pm; Mon 11am-10pm; Tue 11am-10pm; Wed 11am-10pm; Thu 11am-10pm; Fri 11am-10pm; Sat 11am-10pm</attr>
    <attr name="Last Delivery">Sun 9pm; Mon 10pm; Tue 10pm; Wed 10pm; Thu 10pm; Fri 10pm; Sat 10pm</attr>
    <attr name="Order Online">http://orders.allmenus.com/restaurant.asp?restid=5999&amp;campusid=835</attr>
    <attr name="Average Entree">$7.95</attr>
    <attr name="Minimum for Delivery">$25.00</attr>
    <attr name="Cuisine">Pizza</attr>
    <attr name="Cuisine">Sandwiches</attr>
    <attr name="Cuisine">Calzones</attr>
    <attr name="Payment accepted">Cash</attr>
    <attr name="Payment accepted">Visa</attr>
    <attr name="Payment accepted">Mastercard</attr>
    <attr name="Payment accepted">Discover</attr>
    <attr name="Payment accepted">Amex</attr>
    <attr name="Nearby School">Hofstra University</attr>
    <attr name="Nearby School">SUNY-Farmingdale</attr>
    <attr name="Feature">Free Delivery</attr>
    <attr name="Feature">Open 7 Days</attr>
    <attr name="Online Order">Yes</attr>
    <date month="5" day="13" year="2010" />
    </attributes>
    </content>
    </listing>
    </listings>
    As you can see, some row has <attr name="Order Online"> and some don't. I want to extract value of this attribute. It can be null for rows that don't have this attribute. How can I do it with extractvalue function? THANKS A LOT!

    I figured it out that I should do the following:
    select extractvalue(value(x),'/listing/content/attributes/attr[@name="Order Online"]')
    from load_xml_file t, table(xmlsequence(extract(t.xml,'/listings/listing'))) x
    Thanks!

  • Need to know how to place a tiling image in the div tags

    Let me see if I can explain what I want to do in a way that makes sense.
    I have created a box using the <div> I want a background image I made in photoshop that has rounded corners. I need this image to stretch or tile the length and width of the box without duplicating the image in the tile. I don't want multiple rounded corner corner boxes appearing. Just the one stretched.
    I am guessing I need to crop the rounded corner top, bottom and take a 1 px tall crop from from the center of the image for tiling and the top and bottom remain fixed in their position.
    I don't know how to place these in the box if my assumptions about cropping are right.
    I don't know how to stretch the width of the image to fit the width of the box either. Do I need to create a fixed width image the width of the box or can it stretch to fill the width?
    Using DW CS6
    Thanks

    Tiling would mean duplicating itself horizontally and vertically to appear as though it were tiled (envision a shower wall).
    You do not want it to tile it sounds like, but you want the background image to cover the entire background by resizing to whatever size the containing <div> is.
    That can be done relatively easily with the css3 background-size property.
    The css would look like this...
    #container_id {
         background-image:url(your_image.jpg);
         background-size:100% 100%;
         background-repeat:no-repeat;
    Then the html would look like this...
    <div id="container_id>
         your content
    </div>

  • How do I make simplesearch look for the same tag in multiple locations

    Currently i'm trying to write a simplesearch implementation that will only return the result it if contains a specific tag. I would also like to include DAM assets in the search, wherein lies the problem:
    I need to look in both jcr:content and jcr:content/metadata for the tag, and if the tag is found in either location, return that page. Here is the code I am trying to use, but it currently only looks for the tag(s) in one location. Any tips on how to get it to look in multiple locations?
    Code:
                        tagPredicate = new Predicate("tags2", "tagid");
                        tagPredicate.set("property", "jcr:content/cq:tags");
                        for (Cookie cookie : tagsFromCookie) {
                                       if (cookie.getName().contains(CREDENTIALS)) {
                                                      tagPredicate.set("tagid",
                                                                          (cookie.getValue().replaceAll("---", ":")));
                                                      search.addPredicate(tagPredicate);
    Thanks for any help you can give!

    I figured this one out on my own. Kind of a "Doh!" moment.
    What I ended up doing is this: I created a PredicateGroup, and populated this group with the predicates I needed. Then, I set the PredicateGroup allRequired to false. Voila! It works!
    Code:
              PredicateGroup tagPredicateGroup = new PredicateGroup();
                        tagPredicateGroup.setAllRequired(false);
                        Predicate tagPredicate = new Predicate("tags", "tagid");
                        if (slingRequest.getParameter(GROUP1) != null) {
                                       tagPredicate = new Predicate("tags", "tagid");
                                       tagPredicate.set("property", "jcr:content/cq:tags");
                                       tagPredicate.set("tagid", GROUP1);
                                       tagPredicateGroup.add(tagPredicate);
                                       tagPredicate = new Predicate("damTags", "tagid");
                                       tagPredicate.set("property", "jcr:content/metadata/cq:tags");
                                       tagPredicate.set("tagid", GROUP1);
                                       tagPredicateGroup.add(tagPredicate);
                        return tagPredicateGroup;

  • How to insert a script code before the /head tag?

    Would like to insert a <script> code inside all the pages of my website, and it has to be placed before the </head> code.
    Can I manage this with muse? Else, each time when I export the site as HTML, I need to open the updated file(s) and copy and paste again the SCRIPT code in the HEAD.

    Adding scripts to the head section of your documents is not currently supported in Muse, however it is planned for future versions of Muse.
    You can add links for scripts using Object -> Insert HTML, but they will be inserted roughly at the position of the HTML page item.

  • Why my JSP can not recogonize the JSTL tag??

    My hello.jsp code is like follows:
    <%@ include file="/WEB-INF/jsp/include.jsp" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
    <html>
    <head>
    <title><fmt:message key="title"/></title>
    </head>
    <body>
    <h1><fmt:message key="heading"/></h1>
    <p><fmt:message key="greeting"/> <c:out value="${model.now}"/></p>
    <h3>Products</h3>
    <c:forEach items="${model.products}" var="prod">
    <c:out value="${prod.description}"/> <i>$<c:out value="${prod.price}"/></i><br><br>
    </c:forEach>
    </body>
    </html>
    When I start the tomcat server and run my application ,the tomcat shows the error message:
    org.apache.jasper.JasperException: /WEB-INF/jsp/hello.jsp(5,17) No tag "" defined in tag library imported with prefix "fmt"
    But I do import the tag library, why it still show the error that No tag "" defined in tag library ???
    Message was edited by:
    Mellon
    Message was edited by:
    Mellon
    Message was edited by:
    Mellon
    Message was edited by:
    Mellon
    Message was edited by:
    Mellon
    Message was edited by:
    Mellon
    Message was edited by:
    Mellon

    Ok, now I have specify the <taglib> in my web.xml file and I have paste the fmt.ltd under WEB-INF/ like this:
    <taglib>
    <taglib-uri>http://java.sun.com/jstl/fmt</taglib-uri>
    <taglib-location>/WEB-INF/fmt.tld</taglib-location>
    </taglib>
    <taglib>
         <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
         <taglib-location>/WEB-INF/c.tld</taglib-location>
    </taglib>
    When I re-deploy my application and start the tomcat server, the error message now is still :
    jsp/hello.jsp(6,17) No tag "" defined in tag library imported with prefix "fmt"
    My include.jsp is used to import all the libraries that needed,like follows:
    <%@ page session="false"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
    My hello.jsp is like follows:
    <%@ include file="/WEB-INF/jsp/include.jsp" %>
    <html>
    <head>
    <title><fmt:message key="title"/></title>
    </head>
    <body>
    <h1><fmt:message key="heading"/></h1>
    <p><fmt:message key="greeting"/> <c:out value="${model.now}"/></p>
         <h3>Products</h3>
    <c:forEach items="${model.products}" var="prod">
    <c:out value="${prod.description}"/> <i>$<c:out value="${prod.price}"/></i><br><br>
    </c:forEach>
    </body>
    </html>
    Why? I just import the fmt.ltd, everything seems correct, why this error? It seems that tomcat can not find the "fmt" prefix in tag library.
    Please Help:(
    Message was edited by:
    Mellon
    Message was edited by:
    Mellon

  • Using the ORACLE tag

    Hi,
    I am trying to remeber how to use PL/SQL code using the <ORACLE> tag in some of the pre-defined portlets.
    Please HELP!
    I tried to use this in HTML portlet
    <ORACLE>
    execute schema.some_procedure;
    </ORACLE>
    ... and it didnt work.
    Thanx for any advice.
    Petr

    Petr,
    I'm not sure why the HTML portlet doesn't display but I was able to display using an unstructured UI template.
    for e.g
    <oracle>
    declare
    enduser varchar2(20);
    begin
    enduser:=portal.wwctx_api.get_user;
    htp.p(enduser);
    end;
    </oracle>

  • Setup the JSTL system

    Currently I encounter a difficulty in resolving the JSTL tag in the JSP page, such as using <c:xxxx, it always complains about the run time expression ${status.value}.
    I need some help to setup the following files:
    1) Under the /WEB-INF/lib, do I need to setup the jstl.jar?
    2) Under the /WEB-INF/, do I need to setup the c.tld?
    3) In the web.xml, do I need to add the entry:
    <taglib>
    <taglib-uri>/WEB-INF/c</taglib-uri>
    <taglib-location>/WEB-INF/c.tld</taglib-location>
    </taglib>
    OR, something else?
    4) In the JSP page, I entered the following, to correspond to the web.xml file:
    <%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
    Please have a review of the files I try to setup. Much asspreciation.
    Thanks.
    Scott

    Currently I encounter a difficulty in resolving the
    JSTL tag in the JSP page, such as using
    <c:xxxx, it always complains about the run time
    expression ${status.value}.
    I need some help to setup the following files:
    1) Under the /WEB-INF/lib, do I need to setup
    the jstl.jar?Yes, and any other JARs that it needs.
    2) Under the /WEB-INF/, do I need to setup the c.tld?No. The class loader should find the .tld in the JAR file.
    3) In the web.xml, do I need to add the entry:
    <taglib>
    <taglib-uri>/WEB-INF/c</taglib-uri>
    <taglib-location>/WEB-INF/c.tld</taglib-location>
    </taglib> No, see above. These are already in that JAR file.
    OR, something else?Yes, see the answer to #4.
    4) In the JSP page, I entered the following,
    to correspond to the web.xml file:
    <%@ taglib uri="/WEB-INF/c.tld" prefix="c" %>
    The URI is incorrect. You should be using the value of the <uri> tag in the c.tld that's packaged in the JAR file. Depending on the version of JSTL you're using (1.0 or 1.1), it'll look like this:
    http://java.sun.com/jstl/core // for version 1.0
    http://java.sun.com/jsp/jstl/core // for version 1.1make sure you're using a version of JSTL that matches the servlet/JSP spec level for your app server.
    Much asspreciation.Well that's a fine thanks for all my help! 8)
    %

  • How To display the value of outer loop with inner loop fields

    Hi All
    I have a issue that i have to display the values flexfield wise ,like i have 3 DFF values in xmlp layout ,each will have some list of records which will be displayed under the DFF values,so it means
    DFF values will be in outer loop with its group
    while related records of DFF will comes in inner loop with its group
    my problem is that i have to display the DFF values also with respective inner records ,
    Would somebody please suggest how can we achieve this ,please let me know if my question is not clear.
    Thanks
    Pratap

    I think you will be having xml structure like this:
    <G_HEADER>
    <LIST_G_LINES>
    <G_LINES>
    </G_LINES>
    </LIST_G_LINES>
    </G_HEADER>
    So in this case, if you want to refer G_HEADER details in G_LINES then, you should navigate 2 levels above.
    It will be <?../../element_name?>

Maybe you are looking for