It's not a secret anymore!*
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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
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: 60822
    
  65

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


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