防止java中同一用户的多个用户登录 [英] preventing multiple user login for same user in java

查看:48
本文介绍了防止java中同一用户的多个用户登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 java 与 struts2 框架和 sqlserver 2005 数据库一起使用.我需要帮助防止多个用户使用相同的用户名登录.我尝试使用 session .. m 这个框架的新手.如果有人可以帮助我,那就太好了.我通过在数据库中使用一个标志并将其设置为 true .. 并在注销时将其设置为 false .. 但我遇到的问题是当某些用户意外关闭浏览器或发生其他一些中断时.. 用户不会能够登录...我完全困惑 wat 方法我应该使用 ..我不能使用任何会话或 cookie .. 如果有任何简单的方法,请帮助我解决这个问题 ..

I am using java with struts2 framework .and sqlserver 2005 database . i need help in preventing multiple user login with same username. i tried using session .. m new to this framework . if any one could help me it will be great . i did by using a flag in database and setting it to true .. and while logout it will be set to false .. but the problem i got is when some user accidently close the browser or some other interrupt happens .. the user will not be able to log in ...m totally confused wat method should i use ..i dint use any session or cookies .. if there s any simple method is there pls help me out of this ..

推荐答案

使用登录用户维护应用程序映射.如果任何用户尝试使用相同的用户 ID 创建不同的会话,则她的会话无效.

Maintain application map with logged in user. if any user try to create different session with the same userid invalidate her session.

这篇关于防止java中同一用户的多个用户登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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