• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot login the same user on two browser at the same time using Struts 2 application

 
Sushant Gandhi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone, I'm developing the struts 2 application, in that i want to develop such application in that at the same time the same user data can not use two browser for LOGIN, I'm trying to use the actioncontext for that but not success that code....please give me the code for such that application....Thank you in advance
 
Joe Ess
Bartender
Posts: 9295
10
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sushant Gandhi wrote:.please give me the code for such that application.


That's not what we do here. We would be glad to help you work on your problem. What have you tried so far?
 
Sushant Gandhi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joe Ess wrote:
Sushant Gandhi wrote:.please give me the code for such that application.


That's not what we do here. We would be glad to help you work on your problem. What have you tried so far?



Here the code:--

1) Action class:---




2) Fetching data from db class:-


3)Custom Interceptor class:--



4)web.xml:-


5)struts.xml:--



6)Login.jsp:--




please help me for prevent accessing same username and password at the same time with twice browser...
 
Sushant Gandhi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please also tell me how can i pass the message to console when the session has been time out.....All code are display above...Please help me out of this
 
Karthik Jayachandran
Ranch Hand
Posts: 91
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sushant Gandhi wrote:pass the message to console when the session has been time out.

Use HttpSessionListener.


Please use Code tag to format your above code for better readability.
 
Sushant Gandhi
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Karthik Jayachandran wrote:
Sushant Gandhi wrote:pass the message to console when the session has been time out.

Use HttpSessionListener.


Please use Code tag to format your above code for better readability.



No use dude.....its not working ....Tell me another option..
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34648
364
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've added the code tags for you. As far as the feature, it isn't a trivial thing that you can use a listener and be done with it.

You need to keep track of who is logged in. If you only have one clone, this can be done in memory. Otherwise, you need an external datastore like a database table.

When a user logs in, you need to decide what to do. If the user is already logged in, what do you want to do? You might automatically logout the old session. You might ask the user if they want to logout the old session.

Keep in mind that you don't always know when a user logs out. You might have to wait for session timeout. Hence the inclination to logout the old user.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic