Why $ {! Blabla.blibli} returns true in JSTL even if blabla doesn't exist?

As the title mentioned, I don't understand why, when the blabla variable doesn't exist, I:

${blabla.blabla}

which returns nothing

and

${!blabla.blabla}

which returns true

I am assuming there is an implicit exception throwing in the jstl evaluation, but I cannot understand the inner process and why it works like this, especially if we have language: not empty

and other validation components. What is the logic?

+3


source to share


1 answer


JSP EL

NULL

friendly, if the given attribute is not found, or the expression returns NULL

, it does not throw any exception.

For arithmetic operations, EL treats null as 0

, and for logical operations, EL treats NULL

as false

.



So when you try "!" for a variable that is not found it returnstrue

Hope this helps!

+1


source







All Articles