ex2. application

Posted 2008/10/16 13:50, Filed under: 학과수업들/JSP

<%@ page contentType="text/html; charset=euc-kr" pageEncoding="euc-kr" import="java.io.*" %>

<%
String sData, aData;
sData = "안녕 세션";
aData = "안녕 어플리케이션";
session.setAttribute("sData", sData);
application.setAttribute("aData", aData);
%>

<html>
<head><title> session and application attributes </title></head>
<body>
<center>
세션과 어플리케이션 속성을 설정하였습니다.<br>
<a href="application2_result.jsp">같은 세션에서 확인하기</a>
</center>

</body>
</html>



<%@ page language="java" contentType="text/html; charset=euc-kr" pageEncoding="euc-kr" import="java.util.*" %>

<%
Enumeration atts;
String key;
%>

<html>
<head><title> session and application attributes </title></head>
<body>
<b>세션 속성들 : </b><br>
<%
atts = session.getAttributeNames();
while ( atts.hasMoreElements() ) {
	key = (atts.nextElement() ).toString();
%>
<%= key %> = <%= session.getAttribute(key) %> <br>
<% } %>
<br>
<b>어플리케이션 속성들 : </b><br>
<%
atts = application.getAttributeNames();
while ( atts.hasMoreElements() ) {
	key = (atts.nextElement() ).toString();
%>
<%= key %> = <%= application.getAttribute(key) %> <br>
<% } %>
<br>

</body>
</html>



<%@ page language="java" contentType="text/html; charset=euc-kr" pageEncoding="euc-kr" import="java.util.*" %>

<html>
<head><title> session and application attributes </title></head>
<body>
<%
session.removeAttribute("sData");
application.removeAttribute("aData");
%>

<b>세션 속성들 : </b><br>
<%
Enumeration atts;
String key;

atts = session.getAttributeNames();
while ( atts.hasMoreElements() ) {
	key = (atts.nextElement() ).toString();
%>
<%= key %> = <%= session.getAttribute(key) %> <br>
<% } %>
<br>
<b>어플리케이션 속성들 : </b><br>
<%
atts = application.getAttributeNames();
while ( atts.hasMoreElements() ) {
	key = (atts.nextElement() ).toString();
%>
<%= key %> = <%= application.getAttribute(key) %> <br>
<% } %>
<br>

</body>
</html>

2008/10/16 13:50 2008/10/16 13:50

Trackback URL : http://mysilpir.net/trackback/323

Leave a comment

« Previous : 1 : ... 9 : 10 : 11 : 12 : 13 : 14 : 15 : 16 : 17 : ... 270 : Next »

블로그 이미지

일상의 이야기를 나누는 공간입니다.

- 실피

Calendar

    «   2009/01   »
            1 2 3
    4 5 6 7 8 9 10
    11 12 13 14 15 16 17
    18 19 20 21 22 23 24
    25 26 27 28 29 30 31

Total 157590 hit (Today 35, Yesterday 185)

Admin Write Post