I'm new with java EE. So i need someone give some clue. I want to develop some login page that connect to db.
The page will retrieve the user from db. If correct, user will log in to the system.
I dunno how to link with db. If someone can give me guide, i want to use hibernate framework. I'm using MyEclipse as my ide.
Im using netbeans6.1 but this migth help.
Im also using Java sun application server as my web server which you can download at the sun site
I have a login.jsp which contains a username textfield and a password field a "Login" Button and a "Clear"Button
In the log-in button, i call my LogIn servlet and passes the data in the username and password field using session or request.
The servlet is the one who will test the username and password, it will connect to the database using the select command.
In my database I have a username field, password field, and Access Rigths (to determine admin or Normal user)
Select * from account where in username=? AND password=?
After retrieving the data I'll check if i got a hit/miss using if statement.
that means i got a valid username and password then i go into another series of if-else comparing the access rigths. if i found that it is a admin the servlet shall direct it to the admin page or a normal user into a regular page.
here is how to direct a page:
else if the servlet found a non-valid username it goes to
or you may wish to return it the log in page and give it some error message.
*A few Notes*
-Make sure you configure your web server like Connection pools and JNDI (correct me if i got this one wrong)
-Make sure that the driver of the JDBC is installed and the Web-inf/web.xml is also configured correctly (this is used to declare you servlet for the use of the web server *i dont know how to this in ecllipse*
I hope my idea helps
I kind blur because this is 1st time and i didn't yet learn how to user jsp and servlet. Beside that, i not learn how to use JNDI. But i know how to set db using eclipse and mysql connector j.
My friend talking about server side code generator but i dont understand what he talking about.
But i will study my own. I'll post again if stuck with this.