I need to display a table using jstl. The columns are id, tie_id, comments.
id is the primary key in table. I want to display rows having same tie_id with same color.
How can I write jstl loop for this?
Each row tie_id may not be different. For example, first three rows will have same tie_id=1, next two will have same tie_id=2 etc.
I need to compare tie_id of each row using jstl.
How many different tie_id values might you have? 3? 47? 1023? 1048576?
If you're going to come up with a unique color for each unique tie_id, will you have enough colors?
Are the records going to be grouped by tie_id? If not, should they be?
If they are grouped by tie_id, then can't you just alternate colors between different sets of tie_id values, as in:
namita sasa
Ranch Hand
Joined: Apr 20, 2009
Posts: 56
posted
0
Thanks for your replies Mark and Bear. I don't know in future how many tie_id's will be there. So, I am going to repeat the colors. I have set color array of string in session having 10 colors. After the 10'th color, again the first color repeats and so on.
The records are grouped by tie_id. I have set following loop and getting error message. I am taking value of tie_id of first row=first_tieId and then compare it with tie_id of other records. If tie_id are different, a new color will be set.
Erroe Message : Unable to find a value for "1" in object of class "java.lang.String" using operator "[]"
Please help!
namita sasa
Ranch Hand
Joined: Apr 20, 2009
Posts: 56
posted
0
I am getting stuck because I am not able to access the color array in JSP which is in session scope.
Help!
Mark E Hansen
Ranch Hand
Joined: Apr 01, 2009
Posts: 639
posted
0
How did you create this array and place it in the session scope (show the code that did this).
namita sasa
Ranch Hand
Joined: Apr 20, 2009
Posts: 56
posted
0
I got the answer. I just accessed it using ${sessionScope.color[i]} and it worked. Thanks again you all!!
Mark E Hansen
Ranch Hand
Joined: Apr 01, 2009
Posts: 639
posted
0
namita sasa wrote:I got the answer. I just accessed it using ${sessionScope.color[i]} and it worked. Thanks again you all!!
Yes, but then you're setting another variable called color? Won't this be confusing?
Perhaps you could call one color_list?