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

Ads

 
 

Share on Google+Share on Google+

Patel Dolar M.
insertin form data into databse and blank all form field when click on submit button
1 Answer(s)      6 years ago
Posted in : JSP-Servlet

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

Ads
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
PHP HTML Form Submit Button
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... in Html is used to submit form data to the page mentioned in the ACTION attribute
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 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
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 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
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
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
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
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
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
focus to the first form field
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
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
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
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 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
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
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
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
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
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

Ads

 
Advertisement null

Ads