简体   繁体   中英

jsp session lost after javascript window.replace.location with other jsp page

我正在开发一个Web应用程序,需要在login.jsp页面之后重定向到home.jsp页面。我需要在主页中使用会话对象。但是每当我尝试从主页访问会话对象时,我都得到了空值重定向后如何从主页访问会话对象而又不丢失会话。我正在使用Java脚本windows.location.replace重定向Jsp页面。

I don't know exact reason but tomcat( or other framework ) doesn't get the session object properly at some point. It happens sometimes because of Request method, or some other xml configurations.

I believe you checked that the value of <%@page session@> is not false and none of your jsp invalidates session object or remove attributes of it.

I lost my error record, so I can't tell you why this is happenning but if you think windows.location.replace is the problem, then try to use response.sendRedirect( "url" ) in your jsp.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM