dis is my first page regpage.jsp where i am filling all data when i click on submit it calls insertreg.jsp i can see in browser but it doesnt display anythin.Please help me.

Thanks,
Sarika

<%-- 
    Document   : index
    Created on : Nov 4, 2010, 9:32:00 AM
    Author     : sarika.sharma
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <form action="/jsp/insertreg.jsp" method="get">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Ionidea</title>
    </head>
    <body>
       
   <center> <h2>REGISTRATION FORM</h2>
       <table border="0">
<tr>
    <td>First Name</td><td><input type="text" name="fn"></td>
</tr>
<tr>
    <td>Last Name</td><td><input type="text" name="ln"></td>
</tr>
<tr>
    <td> Date of Birth</td><td><input type="text" name="dob"></td>
    <tr><td>Gender</td><td><input type="radio" name=g value=M> Male</td><td><input type="radio" name=g value=F> Female</td>
</tr>
<tr><td>Identification</td><td> <select name=id>
    <option value=votercard>Voter Card</option><option value=pancard>Pan Card</option>
<option value=passport>Pass Port</option></select></td></tr>
<tr><td>Address</td><td><textarea name=add row=4 column=20></textarea></td></tr>


</table>
<input type=submit><input type=reset>
</center></form>


</html>

2.insertreg.jsp

<%-- 
    Document   : insertreg
    Created on : Nov 4, 2010, 11:44:06 AM
    Author     : sarika.sharma
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <%@ page import="java.sql.*" %>
    <%
            try {
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                Connection cn = DriverManager.getConnection("jdbc:odbc:Driver= {Microsoft Access Driver (*.accdb)};DBQ=C://registration.accdb");
                Statement smt = cn.createStatement();
                String q = "insert into user values('" + request.getParameter("fn") + "','" + request.getParameter("ln") + "','" + request.getParameter("dob") + "','" + request.getParameter("g") + "','" + request.getParameter("id") + "','" + request.getParameter("add") + "')";
                System.out.println(q);
                smt.executeUpdate(q);
                out.println("Record Submitted");}
                 finally  {
                try {
  cn.close();
                } catch (Exception ignore)
                {}
             finally  {
                    try {
                  smt.close(); 
                }
                        
                 catch (Exception ignore){} 
                        
    %>
</html>

my database name-registration
below are the fields in database

fname lname dob gender iden address

you didn't mention you table name.
1.check your table name.
2.check you table fields any thing more you have missed in insert query.
3. try to write your query like:

String q = "insert into user (fname,lname,dob,gender,iden,address) values('" + request.getParameter("fn") + "','" + request.getParameter("ln") + "','" + request.getParameter("dob") + "','" + request.getParameter("g") + "','" + request.getParameter("id") + "','" + request.getParameter("add") + "')";

4. try to execute printed insert query into your database server.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.