request.getAttribute

<%@ page import="java.util.Date" %>
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<% Date value1=(Date)request.getAttribute("currendDate"); %>
현재 request 기본객체의 "currentDate" 속성 값:<%=value1 %>
<p>
<%
 request.setAttribute("currentDate", new Date());
 value1=(Date)request.getAttribute("currentDate");
%>

값 설정 후, "currentDate" 속성 값 :<%=value1 %>
<p>
<%
 request.removeAttribute("currentDate");
 value1=(Date)request.getAttribute("currentDate");
%>
값 삭제후 "currentDate" 속성 값: <%=value1 %>
</body>
</html>

'My work space > JSP/Servlet' 카테고리의 다른 글

session.setAttribute 에서 주의할 점  (0) 2008.09.08
request 객체  (0) 2008.09.08
jsp/Servlet 기본2  (0) 2008.09.08
JSP/Servlet 기본  (0) 2008.09.08
게시판만들기-검색하기(펌)  (0) 2008.09.08