| Author |
How to assemble column content in jstl without all these when-tests?
|
Thomas Kennedy
Ranch Hand
Joined: Jan 20, 2008
Posts: 137
|
|
I have two HTML columns A and R where I need to display some combination of units (U), dollars (D) and occurrences (O). Column R must mimic the combination selected by A, but using its own data.
The rules are basically that I will display whatever is non-zero, or if everything is zero, I will display units (U) and dollars (D).
So, here is what I have for deciding what to put in column A:
so that the possible values for mode are:
0 -> units and dollars
1 -> units
3 -> dollars
4 -> units and dollars
5 -> occurrences
6 -> units and occurrences
8 -> dollars and occurrences
9 -> units, dollars, occurrences
Is there a better way to pick from these outcomes than doing something like this:
What is a better alternative? This also doesn't handle delimiting ${u1} from ${d1} and so on, so in reality it would be even more complex than shown here.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56158
|
|
|
Seems like something that would be better handled in the controller.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: How to assemble column content in jstl without all these when-tests?
|
|
|