Expression Language
EL이란?
표현식<%= %> 또는 액션 태그<jsp:></jsp:> 를 대신해서 값을 표현하는 언어이다.
EL은 ${value} 로 표현된다.
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
${ 10 }<br/>
${ 99.99 }<br/>
${ "ABC" }<br/>
${ true }<br/>
</body>
</html>EL 연산자
연산자
종류
산술
+, - , *, /, %
관계형
==, !=, <, > , <=, >=
조건
a?b:c
논리
&&, ||
액션태그로 사용되는 EL
<jsp:getProperty name=*"member" property="name"/>* 를 ${ member.name } 로 사용할 수 있다.
내장 객체
내장 객체
설명
pageScope
page객체를 참조하는 객체
requestScope
request객체를 참조하는 객체
sessionScope
session객체를 참조하는 객체
applicationScope
application객체를 참조하는 객체
param
요청 파라미터를 참조하는 객제
paramValues
요청 파라미터(배열)를 참조하는 객제
initParam
초기화 파라미터를 참조하는 객체
cookie
cookie객체를 참조하는 객체
web.xml
여러 servlet에서 특정 데이터를 공유해야하는 경우 context parameter를 이용해서 공유하면서 사용할 수 있다.
obj.jsp
objelOk.jsp
EL표기법을 통해서 코드가 긴 것(가독성이 떨어지는)을 더 간단하게 구현할 수 있다.
Last updated
Was this helpful?