jsessionid出现在由jstl< c:url ..>生成的所有URL中.标签 [英] jsessionid is occurred in all urls which are generated by jstl <c:url..> tag

查看:84
本文介绍了jsessionid出现在由jstl< c:url ..>生成的所有URL中.标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个奇怪的错误:当我第一次在某些浏览器中打开页面时,所有引用都有jsessionid参数(例如<a href="/articles?name=art&jsessionid=5as45df4as5df"..>).

I've got some strange bug: when I open page first time in some browser all references has jsessionid parameter (like <a href="/articles?name=art&jsessionid=5as45df4as5df"..>).

当我按F5或以任何其他方式刷新页面时,所有这些东西都消失了,并且一切正常,直到关闭浏览器为止(所有选项卡也应关闭).当我再次打开它时,我看到这个奇怪的jsessionid参数.

When I press F5 or refresh the page by any other ways all that stuff is disappeared and everything works fine until I close my browser (and all tabs should be closed too). When I open it again I see this strange jsessionid parameter.

我使用jstl <c:url..>标记创建所有URL.

I use jstl <c:url..> tag for creating all URLs.

一段时间以前,我已经读到jsessionid是cookie的替代品,如果cookie被禁用,但是cookie被启用,而我实际上不使用cookie.

I've read some time ago that jsessionid is an alternative to cookies if cookies are disabled, but cookies are enabled and I actually don't use cookies.

推荐答案

这不是错误,是设计使然.创建新会话时,服务器不确定客户端是否支持cookie,因此它将生成一个cookie以及URL上的jsessionid.当客户端第二次返回并显示cookie时,服务器知道不需要jsessionid,并在其余的会话中删除它.如果客户端返回时没有cookie,则服务器需要继续使用jsessionid重写.

This isn't a bug, it's by design. When a new session is created, the server isn't sure if the client supports cookies or not, and so it generates a cookie as well as the jsessionid on the URL. When the client comes back the second time, and presents the cookie, the server knows the jsessionid isn't necessary, and drops it for the rest of the session. If the client comes back with no cookie, then the server needs to continue to use jsessionid rewriting.

您可能不会显式使用cookie,但是您确实隐含了一个会话,并且容器需要跟踪该会话.

You may not explicitly use cookies, but you do implicitly have a session, and the container needs to track that session.

这篇关于jsessionid出现在由jstl&lt; c:url ..&gt;生成的所有URL中.标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆