JSP之Session对象
来源:互联网 发布:网络控制器感叹号 编辑:程序博客网 时间:2024/05/16 03:33
//session_page1.jsp<%@ page language="java" import="java.util.*, java.text.*" contentType="text/html; charset=utf-8"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <base href="<%=basePath%>"> <title>My JSP 'session_page1.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><!--<link rel="stylesheet" type="text/css" href="styles.css">--> </head> <body> <% SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd,HH-mm-ss");session.setAttribute("username", "bluze");session.setAttribute("password", "123456");session.setAttribute("hobby", "run");//session.setMaxInactiveInterval(3); %> <%=sdf.format(session.getCreationTime()) %><br/> <%=session.getId() %><br/> <%=session.getAttribute("username") %><br/> <%=session.getMaxInactiveInterval() %><br/> <a href="session_page2.jsp">链接到session_page2.jsp</a> <% session.invalidate(); %> </body></html>
//session_page2.jsp<%@ page language="java" import="java.util.*, java.text.*" contentType="text/html; charset=utf-8"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <base href="<%=basePath%>"> <title>My JSP 'session_page1.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"><meta http-equiv="cache-control" content="no-cache"><meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"><meta http-equiv="description" content="This is my page"><!--<link rel="stylesheet" type="text/css" href="styles.css">--> </head> <body> <% SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd,HH-mm-ss"); String[] att = session.getValueNames(); for(int i=0;i<att.length;i++){ out.println(att[i]); } %> <%=sdf.format(session.getCreationTime()) %><br/> <%=session.getId() %> </body></html>
//web.xml <session-config> <session-timeout>30</session-timeout></session-config>
0 0
- JSP之session对象
- jsp之session对象
- JSP之Session对象
- JSP内置对象之session
- jsp内置对象之session
- jsp内置对象之-session对象
- JSP内置对象之session对象案例
- jsp内置对象之session对象
- JSP内置对象之------response、session、application
- JSP九大内置对象之session
- JSP的内置对象之session
- jsp内置对象之session的生命周期
- javaweb开发学习jsp内置对象之session对象
- JSP内置对象之session对象简介及调用方法
- jsp九大内置对象之session对象
- JSP的九个内置对象之session对象
- jsp中session对象
- Jsp中的session对象
- 只言片语,C数据类型,函数指针类型
- java中io操作1
- 【phpcms v9】phpcms-v9系统中session存储机制相关文件
- Ubuntu下安装和使用GMP
- dos下打jar包和用bat文件运行
- JSP之Session对象
- Java深入 - Spring 异常处理HandlerExceptionResolver
- Palindrome Partitioning II
- 数据结构之线索二叉树
- 转:nutch相干框架安装使用最佳指南
- 25-沙盒 文件管理者
- hdu 1010 Tempter of the Bone(DFS)
- HDU 1548 A strange lift
- Unity3d角色控制器Character Controller