jsp页面获取整个项目的session信息

<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.util.*"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>功能列表title>
head>
<body>
body>
<%
/** session 信息*/
out.print("
session 信息:"
);
Enumeration en = session.getAttributeNames();
while(en.hasMoreElements()) {
String name = (String)en.nextElement();
out.println("
\nname:"
+name);
out.println("\nvalue:"+session.getAttribute(name));
}
/** cookie 信息*/
out.print("
cookie 信息:"
);
Cookie[] cookies = request.getCookies();
Cookie c = null;
if(cookies!=null){
for (int i = 0; i < cookies.length; i++) {
c = cookies[i];
out.println("
\nname:"
+ c.getName());
out.println("\nvalue:" + c.getValue());
}
}
%>

你可能感兴趣的:(Java,session,jsp,cookies,string,import,null)