aspose file tools*
The moose likes Servlets and the fly likes about locks in servlets and in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "about locks in servlets and in JSP" Watch "about locks in servlets and in JSP" New topic
Author

about locks in servlets and in JSP

nilima komala
Greenhorn

Joined: Mar 03, 2005
Posts: 8
HI Every Body

I have one snippet that when user entered his details wrong for 3 times he would be restricted to log on to that by providing locks unless until the administrator allows him to access and this should be done by using tables in Oracle.
My question is how can we provide lock and release the lock in Servlets or in Jsp and how can we lock the resources by using the database.

Thank you in Advance


Best Regards,
komala
[ February 19, 2006: Message edited by: Bear Bibeault ]
kri shan
Ranch Hand

Joined: Apr 08, 2004
Posts: 1382
This should be moved to servlets / jsp forum.
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

...and so it shall be

Please look for this thread in the Servlets forum.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30955
    
158

Komala,
You would use JDBC to read/update a lock flag for each user in the Oracle database. When a user logs on, you would check this lock flag in addition to the password.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
nilima komala
Greenhorn

Joined: Mar 03, 2005
Posts: 8
Sir,
Thank you for your reply. Can you please explain it with an example sir please.

Once again thank you.



Best Regards,
komala
dema rogatkin
Ranch Hand

Joined: Oct 09, 2002
Posts: 294
Are you using login feature of servlet/jsp container or provide own login procedure? In case of own login procedure locking a user shouldn't be a question, however when you use a container you have to be more creative. You can use a trigger if a contaner authenticate a user against a table in a database. However if your user repository is LDAP or some other directory you can either look how to setup number of failed attempts for a directory you use, or you can setup a filter which counts login attempt and locks login attempt for a blackouted user name. You can also restrict attempts of guessing user name count login attempt from certain IP, cookie and user agent.


Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: about locks in servlets and in JSP