title: jsp_mysql_HTTP Status 500 - Internal Server Error
body: <p>This is my code to delete data from mysql database, and I'm getting this error.</p>
  
  <pre><code>&lt;%@page import='java.sql.*'%&gt;    
  &lt;% Class.forName("com.mysql.jdbc.Driver"); %&gt;
  &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
          &lt;title&gt;JSP Page&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;h1&gt;Hello World!&lt;/h1&gt;
           &lt;%! 
          public class student{
          String URL="jdbc:mysql://localhost:3306/project";
         String USERNAME="root";
         String PASSWORD="xxxx";
         Connection con=null;
         PreparedStatement select,deleteA=null;
         ResultSet resultSet=null;
  
         public student(){               
             try{
             con=DriverManager.getConnection(URL,USERNAME,PASSWORD);           
             select=con.prepareStatement("select id,first_name,last_name from student");
              deleteA=con.prepareStatement("delete from student where id = ? ");             
             }
             catch(SQLException e)
             {
                 e.printStackTrace();               
             }                         
         }
         public ResultSet getstudent(){
         try{           
         resultSet=select.executeQuery();           
         }catch(SQLException e)
         {
             e.printStackTrace();
         }
         return resultSet;
         }  
  
         public int deleteA(Integer id)
          {
          int result=0;
          try{
         deleteA.setInt(1, id);
          result=deleteA.executeUpdate();            
      }
          catch(SQLException e)
          {
              e.printStackTrace();
          }
          return result;
          }
          }  
          %&gt;
          &lt;%
          int result=0;
          student std=new student();
          ResultSet stds=std.getstudent();
          Integer sid=new Integer(0);
          if(request.getParameter("submit")!=null){
          sid=Integer.parseInt(request.getParameter("std"));
          result=std.deleteA(sid);            
          }            
          %&gt;
          &lt;form name="myform" action="delete.jsp" method="POST"&gt;
              &lt;table border="0"&gt;                    
                 &lt;tbody&gt;
                      &lt;tr&gt;
                          &lt;td&gt;name:&lt;/td&gt;
                          &lt;td&gt;&lt;select name="student"&gt;
                                  &lt;% while(stds.next()){%&gt;
                                  &lt;option value="&lt;%= stds.getInt("id")%&gt;"&gt; &lt;%= stds.getString("first_name")%&gt; &lt;%= stds.getString("last_name")%&gt;&lt;/option&gt;
                              &lt;% } %&gt;
                              &lt;/select&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/tbody&gt;
              &lt;/table&gt;
  
              &lt;input type="submit" value="submit" name="submit" /&gt;                
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>after i select name and try to submit..it gives me this error </p>
  
  <blockquote>
    <p>HTTP Status 500 - Internal Server Error</p>
    
    <p>type Exception report</p>
    
    <p>messageInternal Server Error</p>
    
    <p>descriptionThe server encountered an internal error that prevented it
    from fulfilling this request.</p>
    
    <p>exception</p>
    
    <p>org.apache.jasper.JasperException: java.lang.NumberFormatException:
    null root cause</p>
    
    <p>java.lang.NumberFormatException: null note The full stack traces of
    the exception and its root causes are available in the GlassFish
    Server Open Source Edition 4.1 logs.</p>
  </blockquote>