title: java.lang.NumberFormatException: null
body: <p>I have created a login form which contains validations for each field. When i click on submit button function validation() will be invoked to validate all the fields and after successful validation it will redirect to another jsp page where all the details will be inserted in to the Oracle database.</p>
  
  <p>But I'm getting "org.apache.jasper.JasperException: java.lang.NumberFormatException: null" exception. Also "The server encountered an internal error () that prevented it from fulfilling this request" error. I hope you will help me.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
      &lt;script type="text/javascript"&gt;
      function validate()
      {
  
          if(document.frm.username.value=="")
          {
            alert("Please enter Username");
            document.frm.username.focus();
          }
  
          else if(document.frm.mobile.value=="")
           {       
              alert("Please Enter your contact number");
              document.frm.mobile.focus();
           } 
  
         else
         {
          window.location = "insert.jsp";
         }
       }
  &lt;/script&gt;
      &lt;/head&gt;
  
      &lt;body&gt;
      &lt;form name="frm"&gt;
      &lt;table&gt;
      &lt;tr&gt;&lt;td&gt;User Name:&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="username"&gt;&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td&gt;Contact Number:&lt;/td&gt;&lt;td&gt;&lt;input type="text" name="mobile"&gt;&lt;/td&gt;&lt;/tr&gt;
      &lt;tr&gt;&lt;td&gt;&lt;input type="submit" value="Submit" onclick="validate()"&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
      &lt;/table&gt;
      &lt;/form&gt;
      &lt;/body&gt;
  </code></pre>
  
  <p><strong>insert.jsp:</strong></p>
  
  <pre><code>  &lt;body&gt;
               &lt;%@page import="java.sql.*"%&gt;
               &lt;%@page import="java.util.*"%&gt;
      &lt;%
      Connection con=null;
      int mobile=Integer.parseInt(request.getParameter("mobile"));
      String username=request.getParameter("username");
      try{
           Class.forName("oracle.jdbc.driver.OracleDriver");
          con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","manager");
  
      Statement st=con.createStatement();
      st.executeUpdate("insert into stud values("+mobile+",'"+username+"')");
      out.println("Data is successfully inserted!");
  
        }
  
       catch(Exception e)
      {
         System.out.print(e);
      }
      %&gt;
          &lt;/body&gt;
  </code></pre>