title: how I can connect HTML to java to add values in database
body: <p>I want to enter data in database entered from jsp file and dont know how to connect them. Can any one suggest me to connect both files and to add the data entered in jsp form ?</p>
  
  <p>This is my jsp and java files...</p>
  
  <p><strong>test1.java</strong> </p>
  
  <pre><code>package P1;  
  
  import java.sql.*;  
  
  
  class test1 {  
          public static void main(String[] args) throws SQLException, ClassNotFoundException  {  
  
  
              Connection con = null;  
  
              try {  
                  Class.forName("oracle.jdbc.odbc.JdbcOdbcDriver");  
              }  
              catch(ClassNotFoundException ex) {  
                  System.out.println("Error: unable to load driver class!");  
                  System.exit(1);  
              }  
  
              con = DriverManager.getConnection("jdbc:oracle:thin:@192.168.106.87:1521:ORA11G","fuel_db","foel");  
              Statement statement = con.createStatement();  
  
             String command = "INSERT INTO student (name, rollno, class, mobileno) VALUES (?, ?, ?, ?);";  
             statement.executeUpdate(command);  
  
             con.close();  
  
         }  
  
  } 
  </code></pre>
  
  <p><strong>test1.html</strong> </p>
  
  <p>**</p>
  
  <pre><code>&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;FORM&lt;/title&gt;
  
              &lt;script type="text/javascript"&gt;
  
  
          &lt;%
          String name = request.getParameter("name");
          String roll = document.getElementById("rollno");
          String clas = document.getElementById("class");
          String mobile = document.getElementById("mobileno");
  
          test1 myTest = new test1();
          myTest.submitData();
          %&gt;
  
  
  
              function getvalues()
              {
  
                      var name = document.getElementById("name");
                      var roll = document.getElementById("rollno");
                      var clas = document.getElementById("class");
                      var mobile = document.getElementById("mobileno");
              }
  
              function num(e) 
              {
                      var k;
                      document.all ? k = e.keyCode : k = e.which;
                      return (!((k &gt; 64 &amp;&amp; k &lt; 91) || (k &gt; 96 &amp;&amp; k &lt; 123) || k == 8));
              }
  
              &lt;/script&gt;
  
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form action="test1.java" method="post" &gt;
              &lt;table&gt;
                  &lt;tr&gt;
                      &lt;td&gt;First Name: &lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="name" maxlength="10"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;roll:&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="rollno" maxlength="5" onkeypress="return num(event)"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;class:&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="class" maxlength="10"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
                  &lt;tr&gt;
                      &lt;td&gt;Mobile:&lt;/td&gt;
                      &lt;td&gt;&lt;input type="text" name="mobileno" maxlength="10" onkeypress="return num(event)"&gt;&lt;/td&gt;
                  &lt;/tr&gt;       
                  &lt;tr&gt;
                      &lt;td&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;input type="submit" value="Submit" onclick="getvalues()"&gt;&lt;/td&gt;
                  &lt;/tr&gt;
              &lt;/table&gt;
  
          &lt;/form&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>** </p>