You can choose to ignore EL

Yes, EL is a good thing that’s going to save the world as we know it. But sometimes you might want to disable it. Why?

Think back to when the assert keyword was added to the Java language with version 1.4. Suddenly the formerly unreserved and perfectly legal identifier “assert” meant something to the compiler. So if you had, say, a variable named assert, you were screwed. Except that J2SE version 1.4 came with assertions disabled by default. If you knew you were writing (or recompiling) code that didn’t use assert as an identifier, then you could choose to enable assertions.

So it’s kind of the same thing with disabling EL—if you happened to have template text (plain old HTML or text) in your JSP that included something that looked like EL (${something}), you’d be in Big Trouble if you couldn’t tell the Container to just ignore anything that appears to be EL and instead treat it like any other unprocessed text. Except there’s one big difference between EL and assertions:

El is enabled by default!

If you want EL-looking things in your JSP to be ignored, you have to say so explicitly, either through a page directive or a DD element.

Putting <el-ignored> in the DD

<web-app ...>


The page directive takes priority over the DD setting!

If there’s a conflict between the <el-ignored> setting in the DD and the isELIgnored ...

Get Head First Servlets and JSP, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.