EL can’t declare variables by itself ? why it has made it like this ?
Can any body please explain
posted 6 years ago
The motivation of EL is not to help in doing calculations but to help in "presentation". It is there to help in displaying the scoped variables typically assigned in servlets/controllers. Setting values to variables based on a condition or manipulating a variable is best done in Java code (say servlets) and not in the presentation layer (like JSP). Hence it makes sense that it is not allowed to declare / assign to variables using EL.
True and there are also no looping constructs and probably many more things you expect in a "language".
You will typically use it in combination with JSTL (it used to be part of JSTL specs, now part of the JSP specs) where you can defined variables and use loops and so on.
As David Bridgewater says in his book:
EL can supply only the equivalent of the "right-hand side of the equal sign" in a typical computing statement.
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads