insertin form data into databse and blank all form field when click on submit button

Ads
 

insertin form data into databse and blank all form field when click on submit button

sir, i useing the jsp. i want insert form data into Ms-Access database when click on submit button and blank all form field after inserting data into databse. pls help

View Answers

October 31, 2011 at 2:23 PM

You can use the following steps for creating DSN connection:

  1. Open Data Sources (Start->Control Panel->Administrative Tool->Data Sources(ODBC)
  2. Open User DSN tab
  3. Add a user DSN
  4. Select Microsoft Access Driver(*.mdb)
  5. Select database name and Create the DSN name (e.g emp)
  6. Click "Ok" and then try the JSP.

form.jsp:

<form name="form" method="post" action="insertpersons.jsp">
<table>
<tr><td>Name:</td><td><input type="text" name="name"></td></tr>
<tr><td>Address:</td><td><input type="text" name="address"></td></tr>
<tr><td><input type="submit" value="Submit"></td></tr>
</form>

insertpersons.jsp:

<%@page import="java.sql.*"%>
<%
try
{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn =DriverManager.getConnection("jdbc:odbc:access");
Statement st=conn.createStatement();
String name=request.getParameter("name").toString();
String address=request.getParameter("address").toString();
st.executeUpdate("insert into data(name,address) values('"+name+"','"+address+"')");
out.println("Data is inserted successfully");
}
catch(Exception e){}
%>

Ads









Related Tutorials/Questions & Answers:
insertin form data into databse and blank all form field when click on submit button
insertin form data into databse and blank all form field when click on submit button  sir, i useing the jsp. i want insert form data into Ms-Access database when click on submit button and blank all form field after inserting
print form information when click on print button
print form information when click on print button   Sir,I desingn... please help for printing form information by clickin print button after submit data in the database
Advertisements
Expand / Collapse form div when click on button
Expand / Collapse form div when click on button  Hi, I have a form integrated from Wufoo with iFrame code. If the user misses a field an error... formbox expand once the form gets higher? Thanks <div class="formbox
On Click on Submit Button Display Data on Orderlist
On Click on Submit Button Display Data on Orderlist  How can retreive data from database on orderlist on Click on submit Button of same page
submit a form
submit a form  How can we submit a form without a submit button
html code for student registration form
, radio button, Reset button and Submit Form button. We have used Reset button that resets all fields to blank. We have used JavaScript validation... correctly, submit form adds the data. A programmer can use this submit form as he
how to validate all form field values at once.
how to validate all form field values at once.  how to validate all form field values at once. condition:no form field shold contain sometext("--select
How to save form fields into the MySql Database without submit button in jsp?
How to save form fields into the MySql Database without submit button in jsp?  I want to store user inputs into the database using javasccript or ajax or jqury but without submit button. Form Contains three fields
Action Submit Html
;  Action Submit in Html is used to submit a form, When a user clicks on a submit button, the form is sent to the specific address... a code, which helps you in creating a textfield and a submit button. When
How to insert data into databse by JSP form registration page in netbeans
How to insert data into databse by JSP form registration page in netbeans  .... & how to connect tht form to my databse , so it can store data?   1...; password, & after submitting this form it automatically stores data
php form having 2 submit buttons
php form having 2 submit buttons  i have a php form and some text boxes.and 2 buttons"approve" and "disapprove". when i click on approve button the data from form should go in mysql database and mail should go to appropiate
Click On Images of Submit Button Perform Action
Click On Images of Submit Button Perform Action  I have login page in which insert of submit button i used image. Therefor on Click of image i have to validate form , link with database and goto the next page
Ajax form submit
submit. I want quick tutorial that will help me in writing form submit code in Ajax. Thanks   Hi, Read jQuery 'submit' form event tutorial. This tutorial teaches you how to submit form using jQuery framework. Thanks
form field issue
form field issue  how to set the values in form field and form field drop down (doc 2007) using Apache poi
spring form field clearence
spring form field clearence  hi, I have spring form application in which i have security question and answer field for answer field validation after giving wrong format validation occurs but the field remains in that text field
Retrive only requird data from a table in MYSQL databade to JSP file..on a field submit button.
Retrive only requird data from a table in MYSQL databade to JSP file..on a field submit button.  i have MYSQL DB,DB NAME:TRLIST, TABLE NAME:TR_LIST; (FIELD NAMES:NODE,PACKAGE,TR), {VALUES:Row1(CCN,CS4.0,XXX),Row2(SDP,CS5.0,YYY
form field mapping with pdf file using java
form field mapping with pdf file using java   Hai all, I have one requirement that i have one html form.i have to map the form fields with pdf file. means, if click on text field according that perticular field .the data
how to check the radio button automatically depending up on the value of database when editing the form...
button. When the user clicks the particular radio button, that data will get shown... of database when editing the form...  hi...in my application i am editing the form and in that form the data in the database should come but icant be able
clearing text field in spring form
clearing text field in spring form  hi, I have spring form in that i have security question dropdown field and security answer text field ,when i submitted form with errors the answers text field value should be clear, for this i
Use of Text Field
button etc.) through which users can input their data. A form is created using... and the Submit button: The Action attribute of form contains the name of a file where the contents of the form has to be sent when an user clicks on a submit
HTML Form data into .CSV?
HTML Form data into .CSV?  how to store data from html form to csvfile in java
Problem in enctype="multipart/form-data" in JSP
the file itself when i click the submit button. im using enctype="multipart/form-data...Problem in enctype="multipart/form-data" in JSP  im using a page... is post method, and enctype="multipart/form-data" here the code, boolean
Process HTML FORM data
Process HTML FORM data  Can a JSP page process HTML FORM data?   Yes. Preemptive termination of request processing on an error condition... (assuming Java is your scripting language) is to use the return statement when
how to featch data form db?
how to featch data form db?  how to featch data form db?   ...(){ $.getJSON('get','act=all',function(data){ var... methods. Click on the + sign on the left to edit the code."> /** * Handles
when i hit enter it represent action like click a button
when i hit enter it represent action like click a button  Hi, Plz provide a program in html like I want 2 submit buttons,when i hit the enter button it will represent the action like click the 1st submit
JSP view detail page on accept button click
JSP view detail page on accept button click  i Have 1 jsp page in that there r 2 button accept and view details when we click on aceept button it will submit to next page and when click on view details page it will shown the data
Disabling submit button using jQuery
Disabling submit button using jQuery  Hello Sir I want to know - is there any way or approach to disable client side form's "Submit" button. Please give code also.   For all submit buttons, via JQuery, it'd
store form data into word document
store form data into word document  i want form page data, ex username phone number.. to store it in a word document file
submit button
submit button  <p>hi I am trying to insert record in database using hibernate in JSP(Netbeans). When I click insert button it should go...;body> <form method="post" action="Insert.doPost"> Enter
change database values when click next button on jsp page
change database values when click next button on jsp page  How to retrive database values rondomly and display jsp page ,when user click next and previous bottons change the values on jsp page
How to create simple HTML Form?
. The form submit event is called when clicks on the submit button (in our case... page on the website and when user submits (by clicking on the Submit button...;Subscribe" button is also added which is used to submit the form on the server. Here

Ads