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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:24:08+00:00 2026-05-16T04:24:08+00:00

I have a servlet ( that I cannot change ) to gather information to

  • 0

I have a servlet ( that I cannot change ) to gather information to be displayed in on a web page. I use a bean in a JSP page to loop through the information.

I tried to simplify, but my information is stored tables basically like this
alt text http://img36.imageshack.us/img36/4295/schemase.jpg

So for example, the bean stores information in nested arrays like this:

---2009
------TOYOTA
---------BLUE 10
---------RED 20
------CHEVY
---------BLUE 30
---------RED 10
---2010
------TOYOTA
---------BLUE 30
---------RED 12
------CHEVY
---------BLUE 12
---------RED 20

This is great for when I display the report per year, per category, per color. I can easily loop through the years, loop through the categories, then loop through the colors. This is the report I have ( simplified )
alt text http://img841.imageshack.us/img841/3666/reportihave.jpg

Now I need to turn that information sideways. I need to create a report to display the count per color, per year. This is the report I need:

alt text http://img33.imageshack.us/img33/461/reportineed.jpg

How can I rearrange the information within the JSP? Should I use arrays to gather the info, or is there an equivalent to a hash that I can use?

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-16T04:24:09+00:00Added an answer on May 16, 2026 at 4:24 am

    I solved the problem by looping though the lists in the bean until I got to the color list, then started looping through again and again until I found all the records for each color.

    <c:forEach var="year1" items="${Info.list}"  varStatus="yearCounter1" >
        <c:if test="${yearCounter1.count == 1}">
            <c:forEach var="clist1" items="${year1.list}" varStatus="catCounter1">   
                <c:if test="${catCounter1.count == 1}">
                     <c:forEach var="colorlist1" items="${colorlist1.list}" varStatus="colorCounter1">
                                     <!-- this gets me to all possible colors -->
                                     <c:forEach var="year2" items="${Info.list}"  varStatus="yearCounter2" >
                        <c:forEach var="clist2" items="${tlist2.list}" varStatus="catCounter2">
                                                 ....
                                                              <c:if test="${colorCounter1.description==colorCounter3.description&& year2.description==year3.description  && clist2.description==clist3.description}" >
    

    Is it efficient? No.

    Is it a good use of JSTL? No.

    But I am stuck. I cannot change anything in the bean, I had to use JSP to do the work.

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

Sidebar

Related Questions

No related questions found

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.