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

90 Views Asked by At

As mentionned in the title, I don't understand why when the variable blabla does not exist I have:

${blabla.blabla} which returns nothing

and

${!blabla.blabla} which returns true

I guess that there is an implicit exception catch in the jstl evaluation but I can't understand the inner process and why it does work like this, especially when we have in the language : not empty, and other checker components. What is the logic behind ?

1

There are 1 best solutions below

0
On BEST ANSWER

JSP EL is NULL friendly, if given attribute is not found or expression returns null, it doesn’t throw any exception.

For arithmetic operations, EL treats null as 0 and for logical operations, EL treats null as false.

So when you are trying "!" for the variable which is not found it returns true

Hope this helps!