%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>
session对象应用
<%
DateFormat df = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
String name = (String)session.getAttribute("name"); //获取保存在session范围内的对象
String solution = request.getParameter("address"); //获取用户输入的最想去的地方
%>
session对象测试
session属性变化监听器测试
<%
out.println("属性名和属性值
");
Enumeration enema=session.getAttributeNames();
while(enema.hasMoreElements()){
String name_=(String)enema.nextElement();
String value=session.getAttribute(name_).toString();
out.println(""+name_+"="+value+"
");
}
%>