jsp using include & with mysql
Sir,
I am creating a login application using jsp & Mysql.
The Codes are---
Html File......
<html>
<head><title>LOGIN APPLICATION</title></head>
<body bgcolor="sky blue">
<font color="red"><b><blink>PLEASE ENTER THE USERID AND PASSWORD...........</blink></b></font>
<br>
<br>
<form method="get" action="login.jsp">
Enter UserId:<input type="text" name="userId"><br>
Enter Password:<input type="password" name="password"><br><br><br>
<input type="submit" value="LOGIN">
</form>
</body>
</html>
Jsp file.......
<%@ page import="java.sql.*" %>
<%
String mailid=request.getParameter("userId");
String password=request.getParameter("password");
Class.forName(application.getInitParameter("driverclass"));
Connection con=DriverManager.getConnection(application.getInitParameter("url"),application.getInitParameter("user"),application.getInitParameter("password"));
PreparedStatement stmt=con.prepareStatement("Select name from userinfo where mailid=? and password=?");
stmt.setString(1,mailid);
stmt.setString(2,password);
ResultSet rset=stmt.executeQuery();
if (rset.next())
{
out.println("Welcome"+rset.getString(1));
}
else
{
out.println("Invalid Userid Or Password.");
%>
<%@ include file="login.html" %>
<%
}
out.close();
%>
WEB.xml...........
<web-app>
<context-param>
<param-name>driverclass</param-name>
<param-value>com.mysql.jdbc.Driver</param-value>
</context-param>
<context-param>
<param-name>url</param-name>
<param-value>jdbc:mysql://localhost:3306/userinfo</param-value>
</context-param>
<context-param>
<param-name>url</param-name>
<param-value>root</param-value>
</context-param>
<context-param>
<param-name>url</param-name>
<param-value>root</param-value>
</context-param>
</web-app>
It will producing error like...........
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:372)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.lang.NullPointerException
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:164)
org.apache.jsp.login_jsp._jspService(login_jsp.java:55)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
note The full stack trace of the root cause is available in the Apache Tomcat/5.0.28 logs.
Please tell me the complete solution.
Thanks,,,,
View Answers
August 8, 2011 at 1:21 PM
It seems that application doesn't find mysql connector jar file. Download it and put it into lib of jdk and in tomcat lib.
Please go through the following link:
JSP Login Application
Ads
Related Tutorials/Questions & Answers:
jsp using include & with mysql
jsp using include & with mysql Sir,
I am creating a login application
using jsp &
Mysql.
The Codes are---
Html File......
<...;
Jsp file.......
<%@ page import="java.sql.*" %>
<%
String
Advertisements
Image upload in mysql database using jsp servlet
Image 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 upload
upload 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 jsp
Exporting 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 servlet
get 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
JSP &MYSQL
JSP &MYSQL Develop a web page for the telephone directory
using jsp and
mysql
retrieve related data from database using jsp and mysql
retrieve 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
include a jsp file
include a
jsp file Sir,
I have 2
jsp pages. I want to
include second
jsp in the first
jsp page when a button in the first
jsp is clicked. how can I do this. I tried in sevaral ways . I am
using jsp and javascript... anyone
JSP Include jsp
JSP Include jsp
 ...
include either a
static or dynamic file in a
JSP file. If the file is static, its...;Includes
Jsp Page</h2>
<
jsp:
include page="includedJsp.jsp" >
Passing Parameter with <jsp: include>
a
file in a
jsp page. While
using <
jsp:param> we are adding...-->
<
jsp:
include page="AccessincludedParameter.jsp">
<
jsp...Passing Parameter with <
jsp: include>
 
JSP with Mysql
JSP 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:include action tag
jsp:
include action tag
In this section we will discuss about
JSP "include" action tag. The
jsp "include"
tag is used to
include... into Servlet. The
include tag is used to
include another
resource it may be
jsp
jsp/mysql connection
jsp/
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 connection
jsp/
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