title: java.lang.NumberFormatException: with JSP App and mySQL
body: <p>Hi i'm getting an the above error when trying insert data into my database from a jsp application</p>
  
  <p>here is the JSP code </p>
  
  <pre><code>    &lt;%@page contentType="text/html" pageEncoding="UTF-8"%&gt;
  
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;
  &lt;title&gt;Books database&lt;/title&gt;
  &lt;link rel="stylesheet" href="style.css" type="text/css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;br&gt;
  
  &lt;div class="navigator"&gt;
  &lt;a id="currenttab" href="index.jsp"&gt;Add&lt;/a&gt;
  &lt;a href="delete.jsp"&gt;Delete&lt;/a&gt;
  &lt;/div&gt;
  
  &lt;%
    String empfirstname = request.getParameter("empfirstname");
    String empsurname = request.getParameter("empsurname");
    String dpddept = request.getParameter("dpddept");
    String extensionno = request.getParameter("extensionno");
    String mobileno = request.getParameter("mobileno");
    String emailaddress = request.getParameter("emailaddress");
    String username = request.getParameter("username");
    String password = request.getParameter("password");
    if (empsurname != null &amp;&amp; empfirstname != null 
            &amp;&amp; username != null &amp;&amp; password != null) {
        Users.Worker.Insert(empfirstname,empsurname,dpddept,extensionno,
                mobileno,emailaddress,username,password);
    }
  %&gt;
  
  &lt;br&gt; &lt;br&gt; &lt;br&gt;
  
      &lt;form method='post' action='index.jsp'&gt;
                      &lt;table&gt;
                          &lt;tr&gt;&lt;td&gt;Please Enter your first name.&lt;/td&gt;
                              &lt;td&gt;&lt;input type="text" id='empfirstname'&gt;&lt;/td&gt;&lt;/tr&gt;
                          &lt;tr&gt;&lt;td&gt;Please Enter your surname.&lt;/td&gt;
                              &lt;td&gt;&lt;input type="text" id='empsurname'&gt;&lt;/td&gt;&lt;/tr&gt;
                          &lt;tr&gt;&lt;td&gt;Please Enter your Department.&lt;/td&gt;
                              &lt;td&gt;&lt;input type="text" id='dpddept'&gt;&lt;/td&gt;&lt;/tr&gt;
                          &lt;tr&gt;&lt;td&gt;Please Enter your Extension Number.&lt;/td&gt;
                              &lt;td&gt;&lt;input type="text" id='extensionno'&gt;&lt;/td&gt;&lt;/tr&gt;
                          &lt;tr&gt;&lt;td&gt;Please Enter your mobile Number.&lt;/td&gt;
                              &lt;td&gt;&lt;input type="text" id='mobileno'&gt;&lt;/td&gt;&lt;/tr&gt;
                          &lt;tr&gt;&lt;td&gt;Please Enter your email Address.&lt;/td&gt;
                              &lt;td&gt;&lt;input type="text" id='emailaddress'&gt;&lt;/td&gt;&lt;/tr&gt;
                          &lt;tr&gt;&lt;td&gt;Please Enter your email username.&lt;/td&gt;
                              &lt;td&gt;&lt;input type="text" id='username'&gt;&lt;/td&gt;&lt;/tr&gt;
                          &lt;tr&gt;&lt;td&gt;Please Enter your email password.&lt;/td&gt;
                              &lt;td&gt;&lt;input type="text" id='password'&gt;&lt;/td&gt;&lt;/tr&gt;
                          &lt;tr&gt;&lt;td&gt;&lt;input type="submit" name="submit"/&gt;&lt;/td&gt;&lt;/tr&gt;
                      &lt;/table&gt;&lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is the java source code </p>
  
  <pre><code>    package Users;
  
  import java.sql.*;
  import java.util.ArrayList;
  import java.util.List;
  import java.util.logging.Level;
  import java.util.logging.Logger;
  
  
  public class Worker {
  
    static final String url = "jdbc:mysql://localhost:3306/users";
  
    public static void Insert(String empfirstname,String empsurname,
            String dpddept,String extensionno,String mobileno,
            String emailaddress,String username,String password) {
        try {
  
            String insert = "INSERT INTO users(empfirstname,empsurname,dpddept,extensionno,"
                    + "mobileno,emailaddress,username,password)" +
                    "VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
  
            Class.forName("com.mysql.jdbc.Driver");
            Connection con = DriverManager.getConnection(url, "root", "dpd2014");
  
            PreparedStatement ps = con.prepareStatement(insert);
  
  
            ps.setString(1, empfirstname);
            ps.setString(2, empsurname);
            ps.setString(3, dpddept);
            ps.setInt(4, Integer.parseInt(extensionno));
            ps.setString(5, mobileno);
            ps.setString(6, emailaddress);
            ps.setString(7, username);
            ps.setString(8, password);
            ps.executeUpdate();
            con.close();
  
        } catch (Exception ex) {
            Logger.getLogger(Worker.class.getName()).log(
                             Level.SEVERE, null, ex);
        }
    }
  
    public static List GetUsers() {
  
        List&lt;String&gt; list = new ArrayList&lt;String&gt;();
  
        try {
  
            Class.forName("com.mysql.jdbc.Driver");
            Connection con = DriverManager.getConnection(url, "root", "dpd2014");
  
            Statement stmt = con.createStatement();
  
            ResultSet result = stmt.executeQuery("SELECT * FROM users");
  
  
  
            while(result.next())
            {
  
               list.add(result.getString("empfirstname"));
               list.add(result.getString("empsurname"));
               list.add(result.getString("dpddept"));
               list.add(result.getString("extensionno"));
               list.add(result.getString("mobileno"));
               list.add(result.getString("emailaddress"));
               list.add(result.getString("username"));
               list.add(result.getString("password"));
            } 
  
            con.close();
  
        } catch (Exception ex) {
            Logger.getLogger(Worker.class.getName()).log( 
                             Level.SEVERE, null, ex);
        }
            return list;
    }
  
    public static void Delete(String employeeno) {
        try {
  
            String delete = "DELETE from users WHERE employeeno = ?";
  
            Class.forName("com.mysql.jdbc.Driver");
            Connection con = DriverManager.getConnection(url, "root", "dpd2014");
            PreparedStatement ps = con.prepareStatement(delete);
  
            ps.setString(1, employeeno);
            ps.executeUpdate();
            con.close();
  
        } catch (Exception ex) {
            Logger.getLogger(Worker.class.getName()).log( 
               Level.SEVERE, null, ex);
        }
    }
  }
  </code></pre>
  
  <p>and finally this is the mysql table</p>
  
  <pre><code> users
   (Employeeno int(11) AI PK
   empfirstname varchar(30)
   empsurname varchar(40)
   dpddept varchar(30)
   extensionno int(11)
   mobileno     varchar(30)
   emailaddress varchar(30)
   username varchar(30)
   password varchar(30))
  </code></pre>
  
  <p>I hope this is enough info, any help would be appreciated</p>