[JSP & Servlet 배경지식] 8. JSP – Expression Language

<표현언어 : Expression Language>

JSP 기본문법을 보완하기 위한 표현방법으로 여러가지 유연함을 제공한다.

> 1. 11가지 기본객체제공

- pageContext
- pageScope
- requestScope
- sessionScope
- applicationScope
- param
- paramValues
- header
- headerValues
- cookie
- initParam
ex> ${paramValues.ping}

> 2. 데이터 타입

- boolean
- integer
- float
- string
- null

> 3. 연산자

- 수치연산
--- '+'
--- '-'
--- '*'
--- '/' or div
--- '%' or mod
- 비교연산
--- '==' or eq
--- '!=' or nu
--- '<' or lt --- '>' or gt
--- '<=' or le --- '>=' or ge
- 논리연산
--- '&&' or and
--- '||' or or
--- '!' or not
- empty연산
--- empty {값}
- 비교선택 연산
--- {수식} ? {값} : {값}
- 우선순위
--- []
--- ()
--- -(단일) not ! empty
--- * / div % mod
--- +  -
--- <  >  <=  >=  lt  gt  le  ge
--- ==  !=  eq  ne
--- &&  and
--- ||  or
--- ?  :
ex> ${ 10 + 10 }

> 4. 객체의 메서드 호출

ex>
<%@page import="opendocs.test.SampleMethod"%>
<%
    SampleMethod sampleMethod = new SampleMethod();
    request.setAttribute("sm", sampleMethod);
%>
${sm.test('param')}

댓글 남기기