Search code examples
jspjstlconditional-statements

Using conditional expression in JSP


I got the following error, isn't it possible to use this expression in my JSP?

value="${ user.niveauuser == 0 ? 'banni' : ${ user.niveauuser == 2 ? 'membre' : ${ user.niveauuser == 3 ? 'modérateur' : 'Administrateur'}}}" /></td>

What's wrong with this expression?


Solution

  • Try it removing the nested ${ }:

    value="${ user.niveauuser == 0 ? 'banni' : 
        user.niveauuser == 2 ? 'membre' : 
            user.niveauuser == 3 ? 'modérateur' : 'Administrateur'}"