• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to make a method in database access class for login

 
Mustafa Okbar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 212
1
Android Flex Google App Engine
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So are you stuck on an error or something???
 
Mustafa Okbar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 212
1
Android Flex Google App Engine
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since we have change this we have got erros((( Is my code not right?

 
Mustafa Okbar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sai, thanks a lot, your code helped us.^^ Eventually we got that chicky login
 
Jan Cumps
Bartender
Posts: 2588
11
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mustafa, Welcome to the Ranch!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic