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("<br /><strong>session 信息:</strong>");

Enumeration en = session.getAttributeNames();

while(en.hasMoreElements()) {

String name = (String)en.nextElement();

out.println("<br>\nname:"+name);

out.println("\nvalue:"+session.getAttribute(name));

}

/** cookie 信息*/

out.print("<br /><strong>cookie 信息:</strong>");

Cookie[] cookies = request.getCookies();

Cookie c = null;

if(cookies!=null){

for (int i = 0; i < cookies.length; i++) {

c = cookies[i];

out.println("<br>\nname:" + c.getName());

out.println("\nvalue:" + c.getValue());

}

}

%>

上一篇:爬虫之scrapy模拟登陆


下一篇:SpringBoot实现整合mybatis-generator-maven-plugin 1.4.0