Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3443990
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:51:34+00:00 2026-05-18T08:51:34+00:00

i have the following problem (new to jstl), need to create 4 columns of

  • 0

i have the following problem (new to jstl), need to create 4 columns of products in a e-store, however dont know how to manually iterate trhough the array, got this code which repeats the product for each row:

<c:forEach items="${productCollection}" var="product">

        <tr>
            <c:forEach var="i" begin="1" end="4">

                <td>
                    <a href="productDetail.htm"><img width="90" alt="${product.productName}" src="${product.productImage}"/></a>

                    <a href="productDetail.htm"><c:out value="${product.productName}" /></a>

                </td>

            </c:forEach>

        </tr>

    </c:forEach>

i need to move trhough the productColeection arrayList manually on the second loop. i wish i could do something like with the Java Iterator:

<c:forEach items="${productCollection}" var="product">

        <tr>
            <c:forEach var="i" begin="1" end="4">

                <td>
                    <a href="productDetail.htm"><img width="90" alt="${**Iterator.next().**product.productName}" src="${product.productImage}"/></a>

                    <a href="productDetail.htm"><c:out value="${**Iterator.next().**product.productName}" /></a>

                </td>

            </c:forEach>

        </tr>

    </c:forEach>

Im sorry if its a dumb question, any help would be appreciated! Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:51:35+00:00Added an answer on May 18, 2026 at 8:51 am

    assuming you want 4 products per column, and then want to wrap to the next row if there’s more than 4 products, you could use a varStatus:

    <tr>
    <c:forEach items="${productCollection}" var="product" varStatus="status">
        <c:if test="${status.index % 4 == 0 && !status.first && !status.last}">
            </tr>
            <tr>
        </c:if>
    
        <td>
            <a href="productDetail.htm"><img width="90" alt="${product.productName}" src="${product.productImage}"/></a>
            <a href="productDetail.htm"><c:out value="${product.productName}" /></a>
        </td>
    </c:forEach>
    </tr>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new in xslt. I have the following problem. I need within an
I am new to C# and i have the following problem: I need to
Hi i am new to Spring and I have a following problem: I had
I'm kinda new to javascript running on Apache but I have the following problem.
I'm new to wicket and stuck with the following problem: I have a table
i'm new to jquery .I have problem in the following code .I saved it
i am new in JSP,i have some problem with the following code : <%@
am new here. i have a slight problem; PLease look at the following code
I'm new to android and I have following problem I have a ListView. The
I am a new programmer... i have following problem.. Terminating app due to uncaught

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.