July 7, 2009 at 12:23 PM
Hi Friend,
There is a problem in both JSP pages.
If you want to login,try the following code:
1)form.jsp:
<html>
<head>
<title>User Login</title>
<style type = "text/css">
body
{ font-family: tahoma, helvetica, arial, sans-serif; }
table, tr, td
{ font-size: .9em;
border: 3px groove;
padding: 5px;
background-color: #dddddd;
}
</style>
</head>
<body>
<form method = "post" action = "userLogin.jsp">
<p>Enter The User Name and Password to Log into our Student Database</p>
<table>
<tr>
<td>User name</td>
<td>
<input type = "text" name = "username" />
</td>
</tr>
<tr>
<td>Password</td>
<td>
<input type = "password" name = "password" />
</td>
</tr>
<tr>
<td colspan = "2">
<input type = "submit" value = "Log In" />
</td>
</tr>
</table>
</form>
</body>
</html>
2)userLogin.jsp:
<%@ page import = "java.sql.*" %>
<%@ page errorPage = "userDataviewErrorpage.jsp" %>
<%
String name1 = request.getParameter( "username" );
String name2 = request.getParameter( "password" );
Connection connection = null;
Statement statement = null;
Class.forName( "com.mysql.jdbc.Driver");
connection = DriverManager.getConnection( "jdbc:
mysql://localhost:3306/test";, "root", "root" );
statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery("SELECT * from login where username='"+name1+"' and password='"+name2+"'" );
if(resultSet.next()){
out.println("Welcome"+name1);
}else{
out.println("Invalid Username or Password");
}
%>
3)userDataviewErrorpage.jsp:
<%@ page isErrorPage = "true" %>
<html>
<head>
<title>Error!</title>
<style type = "text/css">
.bigRed
{font-size: 2em;
color: red;
font-weight: bold;
}
</style>
</head>
<p class = "bigRed">
The error message was: <br />
<%= exception.getMessage() %>
</p>
<p class = "bigRed">Please try again later</p>
</body>
</html>
The username and password that we used in the JDBC Connection are the MySql username and password.The code we have provided you checks whether the entered username and password is valid or not.
Thanks
Related Tutorials/Questions & Answers:
jsp fie execution in tomcat and using mysql - JDBCjsp fie execution in
tomcat and
using mysql I created 2
jsp files and kept them under a new directory in the web-apps subdirectory of
Tomcat's...:THE LAST
JSP PAGE IS COMING DIRECTLY ON
EXECUTION IN
TOMCAT jsp using include & with mysqljsp using include & with mysql Sir,
I am creating a login application
using jsp &
Mysql.
The Codes are---
Html File......
<... and in
tomcat lib.
Please go through the following link:
JSP Login Application
Advertisements
Image upload in mysql database using jsp servletImage upload in
mysql database
using jsp servlet Hello, I need code to insert image in
mysql database, I have seen the code which is already in your... located inside the application, but i need to upload in
mysql and also for inserting
upload csv to mysql db using jsp uploadupload csv to
mysql db
using jsp upload Hello all,
Please give me the code to uplad .csv from
jsp page and insert values into
MySQl db. I have a table with 8 cloumns.(MDN--varchar(30),Otafdate date,crt varchar(30),dmdn
login page using jsp servlrt with mysql database?login page
using jsp servlrt with
mysql database? Description:
example:total users are 3.each use have username and password save in
mysql database table login.
After successfully login
user1 see only index page,if user2 login
Exporting data from mysql into csv using jspExporting data from
mysql into csv
using jsp Hi friends.... I want to export the data from
mysql to csv file
using... i am having 30 columns in my... want csv file with 10 rows.. i want to do in
jsp... pls help me soon..its very
get info from mysql using jsp and servletget info from
mysql using jsp and servlet HELLO! I wanna create a
jsp page which able to let me get its name, phone and other info by asking the user to key in their email address from
mysql database by
using servlet and
jsp too
retrieve related data from database using jsp and mysqlretrieve related data from database
using jsp and mysql Hi sir,
please give some example of
jsp code for retrieving
mysql database values in multiple dropdown list. if we change a value in a dropdown its related value must
connection of jsp with mysql - JSP-Servletconnection of
jsp with mysql can anybody tell me about connection of
JSP with
MYSQL? and also tell me which version is compatible with
tomcat 4.1 i am
using tomcat 4.1,
MYSQL 5.0 but i have problem with connection
JSP &MYSQLJSP &MYSQL Develop a web page for the telephone directory
using jsp and
mysql Insert a row in 'Mysql' table using JSP CodeInsert a row in '
Mysql' table
using JSP Code
In this section, we will discuss about how to insert data in
Mysql database
using JSP code.
Query...
between your
Tomcat server &
Mysql database Table.
Code to insert row in
Mysql execution - JSP-Servletexecution hi, i am venkata ramesh,
after complition of my servlet program, i start
tomcat server(8080),
using
http://localhost:8080 ,but output... type 'admin' only, i am not given
any password to
tomcat server.
how to execute
JSP-Mysql - JSP-ServletJSP-Mysql Hello friends,
Anyone send me the way how to store image in
mysql database from a
jsp page. Hi friend,
Code to insert image in
mysql Using Jsp :
For more information on
JSP Insert Blob(Image) in Mysql table using JSPInsert Blob(Image) in
Mysql table
using JSP
In this Section, we will insert blob data(image) in
Mysql database table
using JSP code.
A Blob stores a binary..._TO_REPLACE_8
See also :
Display Blob(Image) in
Mysql table
using netbeans with mysql and tomcatnetbeans with
mysql and tomcat Hi. I have to run a
JSP or JAVA file in netbeans with
mysql database and
tomcat server 7.0. But while the page loading itself it say error. ClassNotFoundException: com.mysql.jdbc.Driver. How
JSP with MysqlJSP with Mysql Hi sir,
I trying to several time but i am not get an answer. My questions are
1. How to inserting same field data to different
mysql table
using jsp. That is
creating a form with 5 fields,data's are same
JSP tomcat hostingJSP tomcat hosting Hi,
What is
JSP tomcat hosting?
Thanks
... application on internet.
But if you are
using Tomcat to host the applications then the hosting environment is called as
jsp tomcat hosting.
There are many
jsp/mysql connectionjsp/
mysql connection I am puttng the following files in the lib folder of jdk to connect
jsp and
mysql and in the lib folder of tomacat and in the lib folder of project of netbeans but I am unable to to connect
jsp and
mysql jsp/mysql connectionjsp/
mysql connection I am puttng the following files in the lib folder of jdk to connect
jsp and
mysql and in the lib folder of tomacat and in the lib folder of project of netbeans but I am unable to to connect
jsp and
mysql connecting jsp to mysql - JSP-Servletconnecting
jsp to mysql Hi, i am working on 'Web application development' project that uses
JSP,
MySQL and tomcat.i am not able to connect to the
mysql database through
jsp. After downloading the
mysql-connector-java-5.0
MySQL Generate AlphaNumberic Id In JSP numeric id
using MySQL as database,
tomcat 7 as a server
for deploying the
JSP...
MySQL Generate AlphaNumberic Id In
JSP
In this section we will discus about how to generate id in specific format in
MySQL and
JSP.
This example explains
jsp mysql........... like that all requests nd comments should be display through
jsp and
mysql...
jsp mysql actually i want a page that has two frames nd in 1 frame i'l add a textarea to post some help nd nw when he clicks on post button it has
execution time calculation - JSP-Servletexecution time calculation I want to know how to find out
execution time of an algorithm in java thread program.Pls send me an example of a thread program in which i can calculate the
execution time of my program. Hi
jsp and mysqljsp and mysql i have a form which contains dropdown list. i have to take the values to another
jsp page and perform the calculation on the database which i have earlier
using the values of the selected dropdown list
Display Blob(Image) from Mysql table using JSP Display Blob(Image) from
Mysql table
using JSP
In this section, we will display blob data(image) from
Mysql database table
using JSP code.
A Blob stores... Also :
Insert Blob(Image) in
Mysql table
using JSP
Download Source CodeADS
tomcat jsp call DLLtomcat jsp call DLL Where can i find Example of use
JSP under
Tomcat environment call DLL
tomcat - JSP-Interview Questionstomcat how to run a program of
jsp using tomcat server.please give... the
tomcat, create a folder 'application' into C:\apache-tomcat-6.0.16... that create a
jsp file 'hello.jsp'and put into the 'application' folder.
To start
jsp_mysqljsp_mysql hi,,
plz help me by providing the code for displaying SELECTED columns from
mysql table which are given dynamically through checkboxes...;
<html>
<head><title>Read from
mySQL Database</title>