今天在测试集群配置的时候想到session共享,因此想要获取sessionID,可以通过下面方法:
${pageContext.session.id}
获取文件的真实路径:
<%=request.getRealPath("/")%>
获取项目名称:
${pageContext.request.contextPath}
例如:
<%@ 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> jsessionid=${pageContext.session.id}
<br/>
<%=request.getRealPath("/")%>
<p>项目名称:${pageContext.request.contextPath}YYY</p>
</body>
</html>