servlet 会话_在Servlet中管理会话

servlet 会话

We all know that HTTP is a stateless protocol. All requests and responses are independent. But sometimes you need to keep track of client's activity across multiple requests. For eg. When a User logs into your website, not matter on which web page he visits after logging in, his credentials will be with the server, until he logs out. So this is managed by creating a session.

我们都知道HTTP是无状态协议。 所有请求和响应都是独立的。 但是有时您需要跟踪多个请求中客户的活动。 例如。 当用户登录到您的网站时,无论登录后访问哪个网页,他的凭据都将保留在服务器中,直到注销为止。 因此,这是通过创建会话来管理的。

Session Management is a mechanism used by the Web container to store session information for a particular user. There are four different techniques used by Servlet application for session management. They are as follows:

会话管理Web容器用于存储特定用户的会话信息的机制。 Servlet应用程序使用四种不同的技术进行会话管理。 它们如下:

  1. Cookies

    饼干

  2. Hidden form field

    隐藏表格栏位

  3. URL Rewriting

    URL重写

  4. HttpSession

    HttpSession

Session is used to store everything that we can get from the client from all the requests the client makes.

会话用于存储我们可以从客户端提出的所有请求中从客户端获得的所有内容。

会议的工作方式 (How Session Works)

session management in java

The basic concept behind session is, whenever a user starts using our application, we can save a unique identification information about him, in an object which is available throughout the application, until its destroyed. So wherever the user goes, we will always have his information and we can always manage which user is doing what. Whenever a user wants to exit from your application, destroy the object with his information.

会话背后的基本概念是,每当用户开始使用我们的应用程序时,我们都可以将关于他的唯一标识信息保存在整个应用程序中可用的对象中,直到销毁为止。 因此,无论用户走到哪里,我们都将始终拥有他的信息,并且我们始终可以管理哪个用户在做什么。 每当用户想要退出应用程序时,请使用其信息销毁该对象。

翻译自: https://www.studytonight.com/servlet/session-management.php

servlet 会话

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值