简体   繁体   English

即使关闭并重新打开浏览器,如何使用Java HTTPSession在我的站点上保持会话打开? (不是PHP)

[英]How can I keep the session open on my site using Java HTTPSession even by closing and reopening the browser? (NOT PHP)

I would like to know how I could do to keep the session open on my site even by closing and reopening the browser. 我想知道如何通过关闭并重新打开浏览器来保持会话在我的网站上打开。 Right now I'm studying everything that has to do with Java Servlets, JSPs, etc ...and I should create a project that aims to create an e-commerce site.I will explain myself better with regards to "keeping the session open on my site also by closing and reopening the browser": I would like to do what Amazon does more or less. 现在我正在研究与Java Servlets,JSP等有关的所有事情......我应该创建一个旨在创建电子商务网站的项目。我会更好地解释自己“保持会话开放在我的网站上也关闭并重新打开浏览器“:我想做或多或少的亚马逊做的事情。 Upon registration except for username, password, name, surname ... taken from the form in the database and at the time of login I take this data and i access the site. 在注册时,除了用户名,密码,姓名,姓氏......从数据库中的表格中获取并在登录时我获取此数据并访问该网站。 The problem is that if I close the browser I should log in again and I don't want this.As I understand it, I also need to implement a session to implement the cart where I should save the products I want to buy.So, in summary, how can I make a connection that lasts as long as I want until I press the Logout button? 问题是,如果我关闭浏览器,我应该再次登录,我不想要这个。据我了解,我还需要实现一个会话来实现我应该保存我想要购买的产品的购物车。所以总之,在按下Logout按钮之前,如何建立一个持续时间长的连接?

This is for a university project that consists of the creation of an e-commerce site. 这是一个大学项目,包括创建一个电子商务网站。

Have you tried using cookies? 你尝试过使用过cookies吗? Maybe you can create a code that reads if there is a cookie with the user data, if it exists you can create a new session with that data. 也许您可以创建一个代码来读取是否存在包含用户数据的cookie,如果存在,则可以使用该数据创建新会话。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当浏览器尺寸缩小时,如何使我的网站/图像居中? - How can I keep my site/image centered when browser size shrinks? 如果用户在java中关闭浏览器,如何清除httpsession - How to clear the httpsession, if the user close the browser in java 即使我在同一浏览器中的多个选项卡中打开,如何保持会话活动 - how to keep the session active even i opened in multiple tabs in same browser 如何使用javascript或html为我的网站制作一个跨浏览器友好的文本轮播? - How can I make a text carousel for my site cross browser friendly by using javascript or html? 如何在本机JS中使用AJAX使PHP会话保持活动状态? - How can I keep PHP session alive with AJAX in native JS? 我如何保持弹出 div 始终打开,即使在页面刷新/重新加载时,直到用户使用 HTML5 本地存储关闭它 - How can i keep a popup div always open, even on page refresh/reload until a user close it using HTML5 local storage 如何使用Java将会话限制为单个浏览器选项卡 - How can I use Java to restrict the session to a single browser tab 即使站点离线,如何保持用户脚本正常工作? - How to keep my userscript working, even when the site goes offline? javascript-ajax-在Java中关闭浏览器时关闭会话 - javascript - ajax - to close session on closing browser in JAVA 即使在“另一页”或“浏览器刷新”中,如何让 setInterval countUp 计时器继续计数? - How Can I make setInterval countUp timer keep counting even in “Another Page” or “browser refresh”?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM