• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EL variable

 
Malatesh Karabisti
Ranch Hand
Posts: 153
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EL can’t declare variables by itself ? why it has made it like this ?

Can any body please explain
 
Vishwanath Krishnamurthi
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Malatesh,

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.

HTH,
Vishwa
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2536
113
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Malatesh,

EL cannot declare variables by itself ?

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.


Regards,
Frits
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic