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 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){}
%>









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
PHP HTML Form Submit Button
. The Submit button in Html is used to submit form data to the page mentioned...Topic : HTML FORM SUBMIT BUTTON Part - 4 The another part which is important to covered that is Submit button. If you are following all the previous parts
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
How can we submit a form without a submit button?
How can we submit a form without a submit button?  How can we submit a form without a submit button
submit a form
submit a form  How can we submit a form without a submit button
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
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 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
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... button. When an user enter some text in the text field User name) and clicks
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
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
more Submit buttons in the same form
more Submit buttons in the same form  Can I have two or more Submit buttons in the same form
jQuery 'submit' form event
jQuery 'submit' form event In this tutorial, we will discuss about the  'submit' form event of jQuery. In this example , In this example a text box and a button is given, when we hit the button, it will check
form field issue
form field issue  how to set the values in form field and form field drop down (doc 2007) using Apache poi
focus to the first form field
focus to the first form field  How do I set the focus to the first form field
focus to the first form field
focus to the first form field  How do I set the focus to the first form field
the focus to the first form field
the focus to the first form field   How do I set the focus to the first form field
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
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
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
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
HTML Form data into .CSV?
HTML Form data into .CSV?  how to store data from html form to csvfile in java
Use of Text Field
types of information. A form contains form elements checkbox, text field, radio button etc.) through which users can input their data. A form is created using... The Action attribute and the Submit button: The Action attribute of form contains
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
PHP Form Part-5
form attributes, input type attributes and Submit button attributes. ADS_TO_REPLACE_1 Now, this is the time to use all these properties into one form... we should checked weather the submit button is set or not. If its not set
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
Submit comments in database when user clicks on submit button
be integer number then click submit button. If all the values are submitted... Submit comments in database when user clicks on submit button... database when user clicks the submit button of the page. Create a database: First
Problem when resizing the form - Swing AWT
resizing the form. I have a JTextPane on the JInternalFrame which occupy all the form space at initial stage. we have a button to add a new JTextPane on the form.... But When we resize the form, the old JTextPane moves to its initial position
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
Multiple submit buttons in single xhtml form - Java Server Faces Questions
Multiple submit buttons in single xhtml form  Hi all, Here I am attaching the source of the page , which containig two submit buttons. Somebody suggested to keep eaxh button in different form. I am new to JSF, can anyone split
differences between GET and POST methods in form submit
differences between GET and POST methods in form submit  What are the differences between GET and POST methods in form submitting, give the case where we can use GET and we can use POST methods
form
form   Can I prevent a form from being submitted again
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
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
Multiple submit nuttons in single xhtml form - Java Server Faces Questions
. If any one of the button is clicked , then entire form is submitted. How to avoid this, and how can i make the particular submit button is applicable to a particular... button in different forms . For example in form1 have submit button name submitone
Retrive data from databse to a text field - Java Server Faces Questions
Retrive data from databse to a text field  Hi, Can you give me a source code to rertrve data from Mysql databse to a text field using JSF.....by selecting option from a dropdown option
PHP Form Part-2
are going to send the form data on the same page as the one we have loaded ? to itself.  Save your work again and then click it to submit button... script then you submit your form easily.   To handle the form data
validating a form before data is entered.
validating a form before data is entered.  How can I avoid validating a form before data is entered
multipart/form-data - JSP-Servlet
multipart/form-data  When we are uploading a file we are using the encoded type of form of type multipart/form-data. When we are using this encryption type what are will be the contents in the encoded output. Explain me
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
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.ADS_TO_REPLACE_1   For all submit buttons, via JQuery
HTML form - Java Beginners
(form1 and form 2)with several fields in html. When i click the submit button, it validates all fields then moves to form2. i have a problem with form navigation. i... friend, Code to help in solving the problem : when You submit the form
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
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
How to create simple HTML Form?
on the website and when user submits (by clicking on the Submit button) data goes... on the form submit event. The form submit event is called when clicks on the submit... the data when form data is submitted to the server. Check the demo page at: Simple

Ads