This assumes that you have a boolean property named "closed" on "bean". An actual 1 or 2 isn't a good set of values to use for binary values. And, while in a lot of languages, it's common to use 0 or 1, that doesn't work in Java, which doesn't treat booleans like they are numbers.
If an internal 1-or-2 value is required, define the following method:
I do not recommend simply using EL to test the numeric value directly.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Dec 30, 2011
Hi Tim Holloway, thanks for reply!
I'm newbie in JSF programming but old Java programmer.
Thanks for the example.
Ok : it is a sin if i put logic in JSF instead of the business layer.
Well, it's not a "sin". That implies the sort of pompous dogma that form the edicts of mediocre managers. In this particular case, I'm putting aside my innate pompousness in favour of being devious and evil. For you see, there's a method to this madness:
1. Debugging Java code is easy. Debugging EL is . Hence, my admonition to avoid complex EL code.
2. If you keep the code in the Model and the display definition in the View then you always know which file to find something in without having to go on a "treasure hunt". And, even more importantly, you only have to look at one file listing when doing maintenance instead of bouncing back and forth between 2 of them (the Model and the View). In JSF you don't write much (if any) Controller code, although of course, when you do, it should be placed in the "Controller" place.