
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,,,,

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:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.