I am developing a web app using J2EE. I was struck in disabling the user account if he enters the information incorrectly 3 times. How can we proceed with this?
I am getting the user entered info and sending it to the action class, action class gives it to the services (delegate) class, which in turn pass to DAO class. I am not passing the request method to the DAO class, so I could not maintain a session. So how will I be able to do this.
Any ideas will be greatly appreciated. Also how do we create a new session in the DAO classes.
One way is to store a counter in the HttpSession object that records the number of failed login attempts.
I don't know what your delegate looks like, but you might have a method called something like validateUser() that returns a boolean. When that method returns false the Action class could update the counter in the Session.
Once it reaches 3, the Action class calls another method to disable the account.
Another way would be to store the counter in the database and let the delegate handle everything.
Joined: Feb 17, 2005
That was what I had thought and now implemented, i.e incrementing counter in action class.
But just wanted to know is there any way to get a session value in DAO class.