=============================코드=============================
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
int res = 45 + 171;
pageContext.setAttribute("Res", res); // 페이지 이동이 많은 경우 쓰지 않음!
request.setAttribute("R", 1000); // 다음 페이지까지만 가져가고 싶을 경우
session.setAttribute("S", 10000); // 계속적으로 가져가고 싶은 경우
application.setAttribute("A", 100000); // 서버가 멈추지 않는 한 유효한 값
request.getRequestDispatcher("Ex06.jsp").forward(request, response);
%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h3>
결과 >>> <%=res %> <br/>
결과(EL) >>> ${Res } <br/>
</h3>
</body>
</html>
Ex06.jsp 생성
=============================코드=============================
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h2>JSP 표현식으로 scope 내용 출력</h2>
<h3>
pageContext >>> <%=pageContext.getAttribute("Res") %> <br/>
request >>> <%=request.getAttribute("R") %> <br/>
session >>> <%=session.getAttribute("S") %> <br/>
application >>> <%=application.getAttribute("A") %> <br/>
</h3>
<hr>
<script type="text/javascript">
location.href = "Ex07.jsp";
</script>
<hr>
<h2>표현언어(EL)로 scope 내용 출력</h2>
<h3>
pageContext >>> ${pageScope.Res } == ${Res } <br/>
request >>> ${requestScope.R } == ${R } <br/>
session >>> ${sessionScope.S } == ${S } <br/>
application >>> ${applicationScope.A } == ${A } <br/>
</h3>
</body>
</html>
Ex05.jsp 에서 실행

Ex07.jsp 생성
=============================코드=============================
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h2>표현언어(EL)로 scope 내용 출력</h2>
<h3>
pageContext >>> ${pageScope.Res } == ${Res } <br/>
request >>> ${requestScope.R } == ${R } <br/>
session >>> ${sessionScope.S } == ${S } <br/>
application >>> ${applicationScope.A } == ${A } <br/>
</h3>
</body>
</html>
Ex05.jsp에서 실행
