problem with JSTL <forEach> tag

Discussions

Web tier: servlets, JSP, Web frameworks: problem with JSTL <forEach> tag

  1. problem with JSTL <forEach> tag (1 messages)

    Hello , Plz go through my code

    <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
    <%@ taglib uri="http://java.sun.com/jsp/jstl/core_rt" prefix="c_rt" %>

     for(int i=0; i<userID.size(); i++)

    <jsp:useBean id="list" class="java.util.ArrayList" />
    <%
    list = adminBean.getUserID();
    %>

    <c_rt:forEach var="userID" items="${list}" begin="0" step="1" end="">
    <option value=" <c_rt:out value="${userID}" />"></option>
    </c_rt:forEach>

    Now I DON'T KNOW HOW TO TERMINATE MY FOR LOOP IN JSTL, I WANT TO REPLACE i<userID.size() into jsp end variable inside <c_rt:forEach > tag.

    Plz help me.
    Ciao
    RD
  2. problem with JSTL <forEach> tag[ Go to top ]

    The forEach tag does this automatically. if you simply write the tag as:

    <c:forEach var="userID" items="${list}">
      <option value="<c:out value="${userID}"/>"></option>
    </c:forEach>

    it will automatically start at the beginning of the ${list} collection, step through the items one at a time, and end at the end of the collection.