I want a simple jsp script which takes in value from user
through a form and store it in database.

I wrote the followwing code :

form.jsp :::


Enter in a website name:

Enter the id:

This calls the form confirm.jsp :

<%@ page import="javax.servlet.*" %>
<%@ page import="javax.servlet.http.*" %>
<%@ page import="java.sql.*" %>


Your info has been received:


String queryText = "INSERT INTO mytab VALUES( \""+
request.getParameter("name") + "\" , request.getParameter("id") )";

try {
Statement stmt;
String url = "jdbc:mysql://localhost:3306/test";
Connection con =
DriverManager.getConnection(url,"root", "root");
System.out.println("URL: " + url);
System.out.println("Connection: " + con);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeUpdate(queryText);

catch (Exception e) { }



The first page ( form.jsp) is loading and when i give values in it and
submit....it is not showing any thing....No error...and nothing is
happening ....its just showing "opening formconfirm.jsp " and remainig
like that only.......So can any one help me out......CAn any one point
if im missing anything in the code...or i have to include
anything....Please help me out in this...

Thanks in Advance
sgara Meesala