The Artima Developer Community
Sponsored Link

Java Community News
The Difference Between #{...} and ${...} in EL Syntax

1 reply on 1 page. Most recent reply: Jun 26, 2006 9:15 PM by Ivan Lazarte

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 1 reply on 1 page
Bill Venners

Posts: 2284
Nickname: bv
Registered: Jan, 2002

The Difference Between #{...} and ${...} in EL Syntax Posted: Jun 26, 2006 8:45 AM
Reply to this message Reply
Summary
A recent SDN article explains the difference between the #{...} and ${...} Unified Expression Language syntax, and gives the rational for having two different syntaxes.
Advertisement

In Introducing the EL #{…} Syntax, authors Pierre Delisle and Jennifer Ball explain that the ${...} syntax, which originated with JSP, provides immediate evaluation. By contrast, the #{...} syntax, which originated with JSF, provides deferred evaluation. The need for two different approaches arises because of the difference between JSPs fairly simply request processing and the more elaborate request/response life cycle of JSF components. You can get more information on the EL, and its design rationale, from JSF and JSP: What's New in Java EE 5, Frank Sommers' interview with Ed Burns, co-spec lead for JSF 1.2, and Jan Luehe, spec lead for JSP 2.1.

Java scriptlets mixed with HTML in JSPs have been considered to be quite unreadable by many. Both EL syntaxes attempt to minimize the need for such scriptlets. What is your opinion of the readability of code that uses EL?


Ivan Lazarte

Posts: 91
Nickname: ilazarte
Registered: Mar, 2006

Re: The Difference Between #{...} and ${...} in EL Syntax Posted: Jun 26, 2006 9:15 PM
Reply to this message Reply
it's fine provided you carefully section out the front-end code. just like functions in a traditional programming language are readable using the < 20 rule, i try to seperate out front-end code with constructs like jsp tags and jsp variables (c:set). when you can reduce the output/dynamic portion to simple things like iterating over an object and simply displaying it's properties, it's quite readable.

Flat View: This topic has 1 reply on 1 page
Topic: The Difference Between #{...} and ${...} in EL Syntax Previous Topic   Next Topic Topic: JXTA Project Releases 2.4 Version of Peer-to-Peer Tool

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use