12.07.2015 Views

Beginning Java EE 6 with GlassFish 3, Second Edition

Beginning Java EE 6 with GlassFish 3, Second Edition

Beginning Java EE 6 with GlassFish 3, Second Edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

CHAPTER 11 ■ PAGES AND COMPONENTSwhere expr is a valid expression that is parsed and interpreted. As of JSP 2.1, you can also use thefollowing syntax:#{expr}The ${expr} and #{expr} statements will be parsed and evaluated in exactly the same manner forJSPs. However, for JSF, it is a different matter because, as you’ll see, JSF pages have a life cycle differentfrom that of JSPs. You can use ${expr} for expressions that are evaluated immediately (the expression iscompiled when the JSP is compiled and is evaluated once, when the JSP executes) and #{expr} forexpressions <strong>with</strong> a deferred evaluation (the expression is not evaluated until its value is needed). Thesetwo ELs have been unified, so a JSP and a JSF page can use both, but <strong>with</strong> the life-cycle difference.EL expressions can use most of the usual <strong>Java</strong> operators:• Arithmetic: +, -, *, / (div), % (mod)• Relational: == (eq), != (ne), < (lt), > (gt), = (ge)• Logical: && (and), || (or), ! (not)• Other: (), empty, [], .Note that some operators have both symbolic and word variants (> can be gt, / can be div, and soon). These equivalents allow you to make your JSP XML compliant while avoiding using entity references(such as &lt; for

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!