aspose file tools
The moose likes JSP and the fly likes How to assemble column content in jstl without all these when-tests? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "How to assemble column content in jstl without all these when-tests?" Watch "How to assemble column content in jstl without all these when-tests?" New topic
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
    
  13

Seems like something that would be better handled in the controller.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: How to assemble column content in jstl without all these when-tests?
 
Similar Threads
Check All button for all spring check boxes array
Implementation of google charts in JSP
Using JSTL Data Displayed In Browser Is Getting Fixed To 24576 Bytes(24 KB)
Best choice for pagination?
special characters in JSTL