'Expression Language'에 해당되는 글 1건

  1. 2014.04.30 EL(Expression Language)$와 #
Programming/jsp2014.04.30 10:37
스트럿츠2를 보다 보니 이상한게 있어서 찾았는데
끄앙.. EL에 이런게 있었어?!?!? ㅠㅠ

Immediate and Deferred Evaluation Syntax
 Those expressions that are evaluated immediately use the ${} syntax. Expressions whose evaluation is deferred use the #{} syntax.

Immediate Evaluation
All expressions using the ${} syntax are evaluated immediately. These expressions can be used only within template text or as the value of a tag attribute that can accept runtime expressions.

Deferred Evaluation
Deferred evaluation expressions take the form #{expr} and can be evaluated at other phases of a page lifecycle as defined by whatever technology is using the expression. In the case of JavaServer Faces technology, its controller can evaluate the expression at different phases of the lifecycle, depending on how the expression is being used in the page.

[링크 : http://docs.oracle.com/javaee/6/tutorial/doc/bnahr.html


Value Expressions
Value expressions can be further categorized into rvalue and lvalue expressions. Rvalue expressions can read data but cannot write it. Lvalue expressions can both read and write data.

All expressions that are evaluated immediately use the ${} delimiters and are always rvalue expressions. Expressions whose evaluation can be deferred use the #{} delimiters and can act as both rvalue and lvalue expressions. Consider the following two value expressions:

${customer.name}
#{customer.name}

[링크 : http://docs.oracle.com/javaee/6/tutorial/doc/bnahu.html

Table 6-1 Definitions of Tag Attributes That Accept EL Expressions

Attribute Type

Example Expression

Type Attribute Definition

Dynamic

"literal"

<rtexprvalue>true</rtexprvalue>

Dynamic

${literal}

<rtexprvalue>true</rtexprvalue>

Deferred value

"literal"

<deferred-value>
   <type>java.lang.String</type>
</deferred-value>

Deferred value

#{customer.age}

<deferred-value>
   <type>int</type>
</deferred-value>

Deferred method

"literal"

<deferred-method>
   <method-signature>
      java.lang.String submit()
   </method-signature>
<deferred-method>

Deferred method

#{customer.calcTotal}

<deferred-method>
   <method-signature>
      double calcTotal(int, double)
   </method-signature>
</deferred-method>

[링크 : http://docs.oracle.com/javaee/6/tutorial/doc/bnaia.html]

# (deferred)
JSP 2.1 부터 지원하는 문법으로 JSF(JavaServer Face)에서 사용
$는 표현식이 실행되는 시점에 값을 계산하나
#는 값이 실제로 필요한 시점에 값을 계산한다.

[링크 : http://gangzzang.tistory.com/entry/JSP-표현-언어Expression-Language-또는-익스프레션-언어


신고

'Programming > jsp' 카테고리의 다른 글

apache velocity  (0) 2014.05.19
JSP 서블릿 매핑  (0) 2014.05.08
EL(Expression Language)$와 #  (0) 2014.04.30
POJO - Plain Old Java Object  (0) 2014.04.29
thread-safe singleton  (0) 2014.04.25
oreilly fileupload/multipart 라이브러리(jar)  (0) 2014.04.24
Posted by 구차니

댓글을 달아 주세요