This question already has an answer here:
- How to concatenate a String in EL? 5 answers
I would like to concatenate a string within a ternary operator in EL(Expression Language).
Suppose there is a variable named value. If it's empty, I want to use some default text. Otherwise, I need to append it with some static text.
${(empty value)? "none" : value + " enabled"}
This will not compile however. What would be a correct way to write this? Or is this even possible?
Mc Dowell's answer is right. I just want to add an improvement if in case you may need to return the variable's value as: