본문 바로가기

JSP/session=false

session="false"

session="true" 으로 설정하고 session 객체를 테스트한 경우

<%@ page language="java" contentType="text/html; charset=EUC-KR"
   session="true"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>session="false" Test</title>
</head>
<body>세션객체: session="true" 으로 설정했을 경우<p>
request.getSession() --> <%=request.getSession() %><p>
session --> <%=session %><p>
</body>
</html>

실행결과, 문제 없이 실행되며 session객체에 접근이 가능하다.
세션객체: session="true" 으로 설정했을 경우

request.getSession() --> org.apache.catalina.session.StandardSessionFacade@8046f4

session --> org.apache.catalina.session.StandardSessionFacade@8046f4


session="false" 으로 설정한 경우

<%@ page language="java" contentType="text/html; charset=EUC-KR"
   session="false"%>
<!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=EUC-KR">
<title>session="false" Test</title>
</head>
<body>세션객체: session="false" 으로 설정했을 경우<p>

아래는 문제 없음
request.getSession() --> <%=request.getSession() %><p>

아래는 컴파일 오류
session --> <%---session --%><p>
</body>
</html>