File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes how to make a method in database access class for login Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "how to make a method in database access class for login" Watch "how to make a method in database access class for login" New topic
Author

how to make a method in database access class for login

Mustafa Okbar
Greenhorn

Joined: Apr 04, 2011
Posts: 13
Guys, how to make a method for Database Access class for login? Need some help quick.Thanks in advance


This is what I got so far
Sai Hegde
security forum advocate
Ranch Hand

Joined: Oct 26, 2010
Posts: 198

So are you stuck on an error or something???
Mustafa Okbar
Greenhorn

Joined: Apr 04, 2011
Posts: 13
Ive got a servlet, database and jsp consiting of; connection to postgres with a method that will pass username and password to it. From this it will then be called in the servlet to create an if loop to check if the password and username match, from this a boolean variable in the person class, is changed to true and the servlet will redirect. The jsp is to show the form. this is the breakdown of how it goes:


here is the servlet (note it isnt finished but the logic i talk about before will be implemented




and finally the jsp



Our problem is in the servlet the if statement, i am unsure of what to pass and whether to have a .equals class. If so how do i show that active(boolean variable in person class) is true so that it can redirect them to their profilePage or redirect them appropriately!


Many thanks in advance,
Ilyas
p.s will be highly appreciated!
Sai Hegde
security forum advocate
Ranch Hand

Joined: Oct 26, 2010
Posts: 198

well, assuming that you are working on a beginners project, here is some direction that you'd need...

The logIn() method returns a Person object if the userName and password match, else it returns null... So your code would be



Hope, this helps!
Mustafa Okbar
Greenhorn

Joined: Apr 04, 2011
Posts: 13
Since we have change this we have got erros((( Is my code not right?

Mustafa Okbar
Greenhorn

Joined: Apr 04, 2011
Posts: 13
Sai, thanks a lot, your code helped us.^^ Eventually we got that chicky login
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2476
    
    7

Mustafa, Welcome to the Ranch!

OCUP UML fundamental and ITIL foundation
youtube channel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to make a method in database access class for login
 
Similar Threads
How to use httpsession with dao factory
DB connection and a null pointer exception
firtst foray into JDBC/
Stored proc not found...
405 error