开发者

JSP Session id changes on every refresh

I am facing a problem that the JSP session ID value changes on every Browser refresh on the development server, but I do not know what is the reason.

My JSP sessiontest.jsp:

<%@ 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
</head>
<body>
<a href="sessiontest.jsp?id="><%=session.getId()%>  
</body>

My browser is Firefox 5,and the server is Tomcat 6.

I have tested this JSP on http://localhost:8080/SessionTest/sessiontest.jsp?id=B68DA1C526F083800AED9D83AF1C8BC0, everything is fine and session ID remains the same after refreshing. But if I deploy the war file on the development server, (http://www.company.com/subdomain/SessionTest/sessiontest.jsp), the session ID value changes on every refresh. Any helps would be greatly appreciated. Thanks.


I suspect your company website is not running with only Tomcat server but has an Apache web server fronting it. This is standard practice for corporate web sites.

The Apache web server has some settings and config for mod_proxy for ProxyPassReverse to maintain the session between browser <-> Apache <-> Tomcat.

Can you check with your admin team on that?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜