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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:18:33+00:00 2026-05-28T03:18:33+00:00

I need to loop over a particular list of rows pertaining to a database

  • 0

I need to loop over a particular list of rows pertaining to a database column, which is of type Integer. This column in the database is the foreign key to the parent column ID in the same table.

I have to match the both these values and print in the JSP if there is a match.

I’ve gone through this link Evaluate list.contains string in JSTL and have been trying over to get it working. I don’t know where exactly I’ve gone wrong.

Here is what I have so far:

<c:forEach var="List" items="${Section.LangList}">
    <c:if test="${List['Lang'] == List['Id']}">
        ...
    </c:if> 
</c:forEach>    

This is one of the things that I’ve used to compare the values. I’ve tried the contains and the <c:set> too. Is there something that I’m missing?

  • 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-28T03:18:34+00:00Added an answer on May 28, 2026 at 3:18 am

    You need to start property names with lowercase. The ${Section.LangList} won’t work, it has to be ${Sections.langList}.

    <c:forEach var="List" items="${Section.langList}">
        <c:if test="${List['Lang'] == List['Id']}">
            ...
        </c:if> 
    </c:forEach> 
    

    If that still doesn’t work, another possible cause is that the data type of the both sides is different, even though they contain the same value. E.g. String value of "42" versus Integer value of 42. You need to make sure that the data types are the same.


    Unrelated to the concrete problem, your naming convention is terrible. Each item of a List<Language> surely isn’t another List, but likely the Language class. Also, using the brace notation to access a property with a fixed name is unnecessary. Just use the ${bean.property} notation. The following will make your code more conform naming conventions and more self-documenting:

    <c:forEach var="language" items="${section.languages}">
        <c:if test="${language.lang == language.id}">
            ...
        </c:if> 
    </c:forEach> 
    

    I only still wonder how ${language.lang} makes sense in this context.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to loop over a list of objects, comparing them like this: 0
I need to loop over a query exactly 12 times to complete rows in
I have a BOOST_FOREACH loop to iterate over a list. Unfortunately, I also need
I'm writing a Perl script in which I need to loop over each character
I need a for loop which would print from year 2000 to 2099. [Bindable]
I need to write some code that would loop though all rows of a
I need to loop over my array and set all the vars to false
I need to get all those files under D:\dic and loop over them to
I need to iterate over a List of objects, doing something only for the
I am writing a PHP function that will need to loop over an array

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.