[英]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.