Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-02-2008, 09:43 AM
Member
 
Join Date: Jan 2008
Posts: 21
banie is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-02-2008, 11:37 AM
Eku Eku is offline
Senior Member
 
Join Date: May 2008
Location: Makati, Philippines
Posts: 199
Eku is on a distinguished road
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.
ex:
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.
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:

Code:
request.getRequestDispatcher("AdminPage.jsp").forward(request,response);
else if the servlet found a non-valid username it goes to
Code:
request.getRequestDispatcher("ErrorPage.jsp").forward(request,response);
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
__________________
Mind only knows what lies near the heart, it alone sees the depth of the soul.

Last edited by Eku : 07-02-2008 at 11:41 AM.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 07-03-2008, 03:05 PM
Member
 
Join Date: Jan 2008
Posts: 21
banie is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cannot open database requested in login. Login fails banduskank Database 0 06-25-2008 01:41 PM
problems with my JSP login page ilangocal JavaServer Pages (JSP) and JSTL 1 04-28-2008 07:40 PM
Go back to previous page using session in JSP page gopikarikati009 JavaServer Pages (JSP) and JSTL 0 04-27-2008 05:38 AM
JSP - Login Page Example JavaForums Java Blogs 2 08-13-2007 10:21 AM
Need to return to login page once logout peiceonly Suggestions & Feedback 1 08-10-2007 12:18 PM


All times are GMT +3. The time now is 08:01 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org