HTTP Status 500 - An exception occurred processing JSP page
<pre><code>**HTTP Status 500 - An exception occurred processing JSP page /reg.jsp at line 24
type Exception report

message An exception occurred processing JSP page /reg.jsp at line 24

description The server encountered an internal error that prevented it from fulfilling this request.

exception 

org.apache.jasper.JasperException: An exception occurred processing JSP page /reg.jsp at line 24

    22: Statement st= con.createStatement(); 
    23: ResultSet rs; 
    24: int i = st.executeUpdate("INSERT INTO userinfo" + 
    25:         " (userid, fname, lname, email, pwd)" + 
    26:         " VALUES" + 
    27:         " ('" +  userid+ "'," +

**
</code></pre>

<p>Table: userinfo</p>

<pre><code>Columns:
userid int(11) AI PK 
fname varchar(45) 
lname varchar(45) 
pwd varchar(45) 
email varchar(45)*
</code></pre>

<p>Web Content </p>

<pre><code>WEB_INF
reg.jsp**

    &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%&gt;
    &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
    &lt;html&gt;
    &lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
    &lt;title&gt;regjsp&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;form action="MyApp" &gt;
    &lt;%@ page import ="java.sql.*" %&gt;
    &lt;%@ page import ="javax.sql.*" %&gt;
    &lt;%
    String userid=request.getParameter("userid"); 
    String pwd=request.getParameter("pwd"); 
    String fname=request.getParameter("fname"); 
    String lname=request.getParameter("lname"); 
    String email=request.getParameter("email"); 
    Class.forName("com.mysql.jdbc.Driver"); 
    java.sql.Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/demo",
    "root","mupurili123A"); 
    Statement st= con.createStatement(); 
    ResultSet rs; 
    int i = st.executeUpdate("INSERT INTO userinfo" + 
            " (userid, fname, lname, email, pwd)" + 
            " VALUES" + 
            " ('" +  userid+ "'," + 
               " '"  +  fname + "'," + 
               " '"  +  lname + "'," + 
               " '"  + email + "','" +pwd + "')");
    if (i &gt; 0) {
        session.setAttribute("userid", userid);
        //response.sendRedirect("welcome.jsp");
        out.print("Registration Successfull!"+"&lt;a href='login.jsp'&gt;Go to Login&lt;/a&gt;");
    } else {
        out.print("Registration failed!");
        //response.sendRedirect("index.html");
    }
    %&gt;
    &lt;a href ="Login.html"&gt;Login&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;
    &lt;a href="index.html"&gt;Home&lt;/a&gt;
    &lt;/form&gt;
    &lt;/body&gt;
    &lt;/html&gt;
</code></pre>

<p><strong>Java Resources</strong> 
src</p>

<pre><code>package com.srk.pkg;

import java.sql.DriverManager;
import java.sql.ResultSet;

import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Statement;

public class Conn {
    public static void main(String[] args){
        try{
            Class.forName("com.mysql.jdbc.Driver");
            Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/demo",
                    "root","mupurili123A"); 
            Statement st= (Statement) con.createStatement(); 
            ResultSet rs=st.executeQuery("select *from demo");
        while(rs.next()){
            System.out.println(rs.getInt(1)+" "+rs.getString(2)+" "+rs.getString(3));
            con.close();
        }

    }catch (Exception e){
        System.out.println(e);
    }

}
}
</code></pre>