Servlet HttpSession cookie已禁用 [英] Servlet HttpSession cookies disabled

查看:71
本文介绍了Servlet HttpSession cookie已禁用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Web应用程序中,当用户登录时,使用 HttpSession s = request.getSession(true); 创建 HttpSession 这将在浏览器上使用 jsessionid 创建一个cookie.但是,如果在浏览器上禁用了cookie,我该如何继续登录?

In a web app, when user logs in, a HttpSession is created using HttpSession s = request.getSession(true); This creates a cookie with jsessionid on the browser. But if cookies are disabled on browser, How can i proceed with login?

推荐答案

如果Cookie被禁用.您应该使用URL重写机制进行会话跟踪.

If Cookies are disabled. You should be using URL Rewriting mechanism for Session tracking.

代码示例:

http://www.javadocexamples.com/javax/servlet/http/HttpServletResponse/encodeURL%28String%20url%29.html

这篇关于Servlet HttpSession cookie已禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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