<%@ 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> |
<!-- jsp 中的 4 个 域对象 , 由小 到大的范围是 , page, request, session, application --> |
<% |
|
// 向 page 域 中 存入 数据 |
//pageContext.setAttribute("info", "page", PageContext.PAGE_SCOPE ); |
|
// 向 request 域 存入 数据 |
//pageContext.setAttribute("info", "request",PageContext.REQUEST_SCOPE); |
|
// 向 session 域 中 存入 数据 |
//pageContext.setAttribute("info", "session",PageContext.SESSION_SCOPE); |
|
// 向 application 域中存入 数据 |
pageContext.setAttribute( "info" , "application" ,PageContext.APPLICATION_SCOPE); |
|
%> |
|
<%= pageContext.getAttribute( "info" , PageContext.PAGE_SCOPE ) %> |
<%= pageContext.getAttribute( "info" , PageContext.REQUEST_SCOPE ) %> |
<%= pageContext.getAttribute( "info" , PageContext.SESSION_SCOPE ) %> |
<%= pageContext.getAttribute( "info" , PageContext.APPLICATION_SCOPE ) %> |
|
<hr/> |
<%= pageContext.findAttribute( "info" ) %> |
|
</body> |
</html> |