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 6219711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:49:56+00:00 2026-05-24T07:49:56+00:00

in a JSP I should print the values of an array list in the

  • 0

in a JSP I should print the values of an array list in the “li” html tags. The problem is that I should print in one cycle two values. This is the example in html:

<ul class="myProfileTeamNameList">
    <li><p class="first">- Team_Name_1</p><p>- Team_Name_2</p></li>
</ul>

I have implemented this but I can only print the first value. This is my code:

<ul class="myProfileTeamNameList">
   <c:forEach var="team" items="${teams}">
   <li><p class="first">- ${team.name}</p> <p>- ${team.name}</p></li>
</c:forEach>
</ul>

instead in the second

html tag I should write the SUCCESSIVE array list value. Something like: ${team.name} + 1

Can someone help me? Thanks a lot.

  • 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-24T07:49:57+00:00Added an answer on May 24, 2026 at 7:49 am

    Ideally, you should not use a list. You should use a Map, and loop through its entries to get the key and value.

    But if you really need to use the list, <c:forEach> allows you to write a index-based loop. Instead of items, specify step=2, begin, end and varStatus and then refer to ${items[varStatus.index]} (and .index+1 respectively). E.g.

    <c:forEach step="2" being="0" end="${fn:length(array)}" varStatus="status">
        ${items[varStatus.index]} - ${items[varStatus.index+1]}
    </c:forEach>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In JSP, I notice that I can't render ${} into HTML. After the page
How should I access the ServletContext from a .jsp? For example, how can I
Hey folks, ok so this is my problem, I need to display HTML code
I'm working on an existing Java web application (HTML/CSS/JS/JSP/Servlets and Java classes in this
This question is related to another one I've posted recently: Check printing with Java/JSP
I'm currently writing a JSP-application with webservices. The problem is: I should detect the
I'm creating a wall that, should look and act like Facebook's wall. The problem
I'd like to create a dynamic reporting webpage using JSP. Basically it should contain
I am using a <form:input> on my jsp. The input field should be editable
I writing a JSP program that needs to react on an existing program. It

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.