This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

creating a Loginpage.jsp in JSP with LOGIN id and Password.  RSS feed

Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,
To get to know the concept can anyone answer my questions in detail along with an example.

first step: Have to create a Loginpage.jsp in JSP with LOGIN id and Password.
second step: I am using MS Access as my present database which stores name and password.
Third step: Please explain to me how connection is made between Access and My Loginpage.jsp and what needs to be done in control panel(i donno that too).

Fourth step: This loginpage.jsp shld validate user id and password and if they are correct shld , send it to the next page through session.
[ September 16, 2008: Message edited by: Bear Bibeault ]
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Step 3 :

i )In order to use the MS Access DB, you need to add a Data Source through Ctrl Panel-> Administrative Tools -> Data Sources(ODBC).
ii)Under User DSN, click on Add, select the driver ( in your case, it would be Microsoft Access Driver(*.mdb).
iii) Click on Finish
iv) Provide DataSource name on next screen.
v) Then under Database: click Create and create the DB somewhere on your local system.
vi) For setting password to the DB, click on Advanced button and provide the user name and password.
Click on Finish and you should be all set.

The url for accessing would be
String url = "jdbc:odbc:DataSourceNameYouProvided";

For Step 1, you can a lot of example pages and code in google.
kanna prasanth
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sudershan thanks for your help,

But i want to know about following pgm please:

The problem is in process.jsp(as attached)the line is if(idHandler.validate()).

please help me with

(----------------html page----------------------------------------)
<title>Nouman Rashid page </title>

<p> <h3><center>Please enter your user name and

<form action="process2.jsp " method = "post" >
<center><input type = "text" name=
<center><input type = "password" name =
<center><input type="submit" name="Submit"



(------------------------------jsp page----------------------------------)


<%@ page import="java.util.*" %>
<jsp:useBean id="idHandler" class="foo.Login" scope="request">
<jsp:setProperty name="idHandler" property="*"/>

if (idHandler.validate()) {
<jsp:forward page="success.jsp"/>
} else {
<jsp:forward page="retry.jsp"/>



package foo;
import java.sql.*;

public class Login {

private String username = "";
private String password = "";

public Login() {

public void setUsername(String username) {
this.username = username;

public void setPassword(String password) {
this.password = password;

public boolean authenticate(String username2,
String password2) {
String query="select * from Registration;";
String DbUserName="";
String DbPassword="";
String finalUser="";
try {
Statement stat=con.createStatement();
ResultSet rst=stat.executeQuery(query);



if (username2.equals(DbUserName) &&
password2.equals(DbPassword)) {


return true;
}catch(Exception e){

return false;

A timing clock, fuse wire, high explosives and a tiny ad:
Become a Java guru with IntelliJ IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!