pageContext 用法
来源:互联网 发布:mac下制作winpe 编辑:程序博客网 时间:2024/06/05 06:12
<%@ 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>
<%
//使用pageContext设置属性,该属性默认在page范围内
pageContext.setAttribute("name","jason test");
request.setAttribute("name","霖苑编程");
session.setAttribute("name","霖苑计算机编程技术培训");
//session.putValue("name","计算机编程");
application.setAttribute("name","培训");
%>
page设定的值:<%=pageContext.getAttribute("name")%><br>
request设定的值:<%=pageContext.getRequest().getAttribute("name")%><br>
session设定的值:<%=pageContext.getSession().getAttribute("name")%><br>
application设定的值:<%=pageContext.getServletContext().getAttribute("name")%><br>
范围1内的值:<%=pageContext.getAttribute("name",1)%><br>
范围2内的值:<%=pageContext.getAttribute("name",2)%><br>
范围3内的值:<%=pageContext.getAttribute("name",3)%><br>
范围4内的值:<%=pageContext.getAttribute("name",4)%><br>
<!--从最小的范围page开始,然后是reques、session以及application-->
<%pageContext.removeAttribute("name",3);%>
pageContext修改后的session设定的值:<%=session.getValue("name")%><br>
<%pageContext.setAttribute("name","应用技术培训",4);%>
pageContext修改后的application设定的值:<%=pageContext.getServletContext().getAttribute("name")%><br>
值的查找:<%=pageContext.findAttribute("name")%><br>
属性name的范围:<%=pageContext.getAttributesScope("name")%><br>
<h1>
<script>top.parent.location.href="${pageContext.request.contextPath}/admin/page!login.action";</script>
</h1>
</body>
</html>
<!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>
<%
//使用pageContext设置属性,该属性默认在page范围内
pageContext.setAttribute("name","jason test");
request.setAttribute("name","霖苑编程");
session.setAttribute("name","霖苑计算机编程技术培训");
//session.putValue("name","计算机编程");
application.setAttribute("name","培训");
%>
page设定的值:<%=pageContext.getAttribute("name")%><br>
request设定的值:<%=pageContext.getRequest().getAttribute("name")%><br>
session设定的值:<%=pageContext.getSession().getAttribute("name")%><br>
application设定的值:<%=pageContext.getServletContext().getAttribute("name")%><br>
范围1内的值:<%=pageContext.getAttribute("name",1)%><br>
范围2内的值:<%=pageContext.getAttribute("name",2)%><br>
范围3内的值:<%=pageContext.getAttribute("name",3)%><br>
范围4内的值:<%=pageContext.getAttribute("name",4)%><br>
<!--从最小的范围page开始,然后是reques、session以及application-->
<%pageContext.removeAttribute("name",3);%>
pageContext修改后的session设定的值:<%=session.getValue("name")%><br>
<%pageContext.setAttribute("name","应用技术培训",4);%>
pageContext修改后的application设定的值:<%=pageContext.getServletContext().getAttribute("name")%><br>
值的查找:<%=pageContext.findAttribute("name")%><br>
属性name的范围:<%=pageContext.getAttributesScope("name")%><br>
<h1>
<script>top.parent.location.href="${pageContext.request.contextPath}/admin/page!login.action";</script>
</h1>
</body>
</html>
0 0
- pageContext 用法
- pageContext对象的用法
- pageContext对象的用法
- pageContext对象的用法
- pageContext对象的用法
- pageContext对象的用法
- pageContext对象的用法
- pageContext对象的用法
- pageContext对象的用法
- pageContext对象的用法
- pageContext的用法
- pageContext.setAttribute用法
- pageContext对象的用法
- pageContext对象的用法详解
- pageContext对象的用法详述
- pageContext
- pageContext
- pageContext
- 第六周项目四:分别利用成员函数、友元函数和一般函数求距离
- 连接Access2007/2010数据库的字符串
- (数据结构第五章)数组实现
- [部署篇3]VMWare搭建Openstack——控制节点的glance的安装
- 设计模式之单实例模式
- pageContext 用法
- struts2.0中struts.xml配置文件详解
- js 继承
- android屏幕适配
- 二维数组之蛇形填数
- Block的实现原理
- XCode升级后插件失效的原理与修复办法
- netbeans 8 安装支持python的插件
- linux Linux 3.x的设备树(Device Tree) dts 介绍