File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to assemble column content in jstl without all these when-tests?

 
Thomas Kennedy
Ranch Hand
Posts: 137
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64173
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Seems like something that would be better handled in the controller.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic