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
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 )
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:
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