Results 1 to 3 of 3

Thread: Login page

  1. #1
    banie is offline Member
    Join Date
    Jan 2008
    Rep Power

    Default Login page

    Hi all,

    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.

    Thank you.

  2. #2
    Eku is offline Senior Member
    Join Date
    May 2008
    Makati, Philippines
    Rep Power


    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.
    Java Code:
    Select * from account where in username=? AND password=?
    In my database I have a username field, password field, and Access Rigths (to determine admin or Normal user)

    After retrieving the data I'll check if i got a hit/miss using if statement.
    Java Code:
    ex: If(!rs.getString("username").equals(null)){
    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:

    Java Code:
    else if the servlet found a non-valid username it goes to
    Java Code:
    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
    Last edited by Eku; 07-02-2008 at 10:41 AM.
    Mind only knows what lies near the heart, it alone sees the depth of the soul.

  3. #3
    banie is offline Member
    Join Date
    Jan 2008
    Rep Power


    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.

Similar Threads

  1. Go back to previous page using session in JSP page
    By gopikarikati009 in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 06-23-2011, 10:30 AM
  2. Need to return to login page once logout
    By peiceonly in forum Suggestions & Feedback
    Replies: 2
    Last Post: 03-31-2009, 07:50 PM
  3. Replies: 0
    Last Post: 06-25-2008, 12:41 PM
  4. problems with my JSP login page
    By ilangocal in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 04-28-2008, 06:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts