JSP

JSP EL태그 종류(예시 있음)

공부하고 기억하는 공간 2023. 8. 6. 01:35
728x90
반응형
SMALL

 

 

🟰EL Tag

☀️ attribute에 접근하여 값을 출력한다

☀️다운캐스팅 없이 메서드를 호출할 수 있다.

☀️술연산, 비교연산, 논리연산이 가능하다

☀️empty, not empty 등을 통해 null체크 수행도 가능하다.

☀️대상이 없으면 아무 값도 출력하지 않는다.(null은 출력안함)
☀️\${param.name} 형식으로 파라미터 값을 출력할 수 있다.
☀️내장 객체 pageContext에 접근이 가능하다.

☀️map은 [''], '.'을 이용한 접근이 가능하다(영어한정) , 한글은 ['']만 가능하다.

☀️param은 파라미터를 가져오는 객체이다.

☀️Attribute대상이 아닌 넘어온 파라미터를 대상으로 한다.

 

찾으시는 내용은 Ctrl+F로 더 쉽게 찾을 수 있습니다.

 

 

연산자 예시 결과
+ ${12+23 } 35
- ${12-23 } -11
* ${12*23 } 276
/, div ${10/3 } 3.3333333333333335
%,mod ${10%3 } 1
>,gt ${10>3 } true
%,lt ${10<3 } false
>,ge ${10>=3 } true
%,le ${10<=3 } false
==,eq ${10==3 } false
!=,ne ${10!=3 } true
&&,and ${10%2 ==0 && 10 >2} true
||,or ${10%2 ==0 || 10 <2} true
!,not ${!(10 <2)} true
array[] ${arr[0] } 이효리
list[] ${list[1] } 옥주현
map[] ${map['위'] } 조조
map. ${map.title } 손권
param.name
(request.getParameter("name"))
${param.name } 이지은
param.age
(request.getParameter("age");)
${param.name } 이지은
header. 또는 header[] $header['host']} localhost:8080
header[] $header['user-agent']} Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36
pagecontext ${pageContext} org.apache.jasper.runtime.PageContextImpl@33a13bcd
request ${pageContext.request} org.apache.catalina.connector.RequestFacade@3b61f4e6
session ${pageContext.session} org.apache.catalina.session.StandardSessionFacade@5a2b9f1d
application ${pageContext.servletContext} org.apache.catalina.core.ApplicationContextFacade@4005c769

728x90
반응형
SMALL