0
该项目使用Spring Framework。在index.jsp中设置的会话变量在第三次或第四次通过javascript访问时返回null jsp的
- 有没有办法延长会话变量超时?
- 为了让整个网站的会话变量可访问吗? 我不想在控制器中设置会话变量。
的流程如下:
- '/' 即 “的index.jsp” 呼叫 “country.html” 如果会话变量被设置为空。
- 然后,用户在“country.html”中选择一个国家,并将表单提交给“/index.jsp”
- 然后,“index.jsp”使用“request.getParameter(countryCode)”获取值,如果不为null那么它使用“objectSession.setAttribute(”countryCode“,IN);”来设置会话变量。
Uptil这里没有问题。 但在我点击像 “/test.jsp”,在 “test.jsp的” 的JavaScript等环节为
VAR COUNTRYCODE返回null ='<%= session.getAttribute( “COUNTRYCODE”) %>';
同样的,如果我的 “/index.jsp” 点击它重定向我 “country.html” 因为
COUN =(字符串)objectSession.getAttribute( “COUNTRYCODE”);
在scriptlet是空的我猜。