web form(html) with jdbc

Ads
 

web form(html) with jdbc

need a example coding to develop a web form of data with jdbc

View Answers

January 24, 2011 at 1:06 PM

Hi Friend,

Try the following code:

1)form.html:

<html>
<form method="post" action="http://localhost:8080/examples/jsp/insertdata.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></td><td><input type="submit" value="Submit"></td></tr>
</table>
</form>
</html>

2)insertdata.jsp:

<%@page import="java.sql.*"%>
<%
String name=request.getParameter("name");
String address=request.getParameter("address");
try{
Class.forName("com.mysql.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
           Statement st=con.createStatement();
           int i=st.executeUpdate("insert into data(name, address) values('"+name+"','"+address+"')");
         con.close();
         out.println("Data is successfully inserted into database.");
}
catch(Exception e){
    System.out.println(e);

}
         %>

Thanks

Ads









Related Tutorials/Questions & Answers:
web form(html) with jdbc
web form(html) with jdbc  need a example coding to develop a web form of data with jdbc   Hi Friend, Try the following code: 1)form.html: <html> <form method="post" action="http://localhost:8080/examples/jsp
What is HTML Form?
What is HTML/Web Form in HTML? In this tutorial we are going to understand about the HTML form, which is also know as the Web Form. This is used... are learning web application development then you must learn to use HTML Form
Advertisements
HTML Form data into .CSV?
HTML Form data into .CSV?  how to store data from html form to csvfile in java
HTML form examples
HTML form examples  Hi, How to create a simple data entry form in HTML and use JavaScript to validate the same. Can anyone share html form examples code? Thanks   Hi, Please see the HTML form example page. Thanks
Registration Form in HTML
Registration Form in HTML  User Registration Form in HTML - i wanted to design a user registration form in HTML. So, Can anyone please guide me or give me a peace of code to design a user registration form in HTML. Thanks
HTML to php form
HTML to php form  Hi, How I can submit the HTML form data to PHP Script? Give me example code. Thanks   Hi, Please see the following tutorials: PHP Form PHP email form Thanks
HTML -- form tag.
HTML -- form tag. Description : HTML provides a form tag. It takes user... within form tag. Code : <!DOCTYPE html PUBLIC "-//W3C//DTD... language</title> </head> <body> <h1>HTML form tag
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 is a good way to maximize the throughput of a high-volume JSP engine. The trick
HTML Form Validation example
HTML Form Validation example  Can anyone guide me how to validate the user name and password field in HTML using simple or JavaScript Validation. Thanks in advance!   <form method="post" onsubmit="return
create html form as follows
create html form as follows  a form that contains two textboxes;one for your name and another for telephone number.telephone number should have exactly 10 digits starting with the digit '9' and name should not be left blank.add
create html form as follows
create html form as follows  a form that contains two textboxes;one for your name and another for telephone number.telephone number should have exactly 10 digits starting with the digit '9' and name should not be left blank.add
How to create simple HTML Form?
HTML Form Tutorial: How to create simple HTML Form? In web application input forms are developed using the HTML tags and the form component provided... user input in any web application. What is form in HTML? The html forms
dynamic web pages in html
dynamic web pages in html  How to create Dynamic web pages in HTML
Html form validation using jquery
Html form validation using jquery  Hi i am using form with html. Form elements like textbox, radio,checkbox,listbox i was used now how to validate the elements using submit jquery option
convert this html form to jsp
convert this html form to jsp  <html> <head> <script...;/tr> <form name="VillageDetailsForm" action="AddVillage.jsp" method... includes html tags so you may change an extension. Please visit the following links
How to Open a File in HTML Form
How to Open a File in HTML Form  Hi, My question in that how could i open a file in HTML Form. Could any one suggest me the examples or online help... it. Otherwise take this examples and syntax that will show how to Open a file in HTML
HTML form validation using jquery
HTML form validation using jquery  Is there any way for validating html elements common under a class by giving its class name in jquery validation code..that means validating all elements by using its class name if those
HTML Post Form
HTML Post Form       The HTML process the submission of form in two different ways. In HTML... to send the form data in the form of message. The Post method in HTML is used
HTML form example
HTML form example In this section we will develop HTML form example and show you how to performance form validation using JavaScript. The HTML <form>...; HTML Form Example </title> <script type="text/javascript">
ModuleNotFoundError: No module named 'rng-to-html-form'
ModuleNotFoundError: No module named 'rng-to-html-form'  Hi, My... named 'rng-to-html-form' How to remove the ModuleNotFoundError: No module named 'rng-to-html-form' error? Thanks   Hi, In your
creating web page for form registration
creating web page for form registration  I am creating web page for form registration to my department ..I have to Reprint the Application Form (i.e Download the PDf File from the Database ) , when the user gives the Application
JSP to add details to a database from a HTML form.
JSP to add details to a database from a HTML form.  Hi I'm a second year CS student who has to use JSP to validate a HTML form and add the details..... Can anyone tell me what is wrong with my code? html code first
example of 1700 bir form using html
example of 1700 bir form using html   example of 1700 bir form using html i don't know how to start it... i'm confused on what would i do first and what would i use... :( please help me on this.... thank you in advance
Create an HTML form login.html that accepts the username and password
Create an HTML form login.html that accepts the username and password   Create an HTML form login.html that accepts the username and password and submits to login.java servlet. Verify credentials and on success, set the username
Html form using JavaScript to display the table content
Html form using JavaScript to display the table content  HI There, Greetings, I am new to this java and I need your assistance. I have created... want to write a Html JavaScript coding to display the content from database
Html form that auto fills outlook to,subject,body
Html form that auto fills outlook to,subject,body  I want to have... and body message. The user will fill out a form on-line when they click send... in it. Below is a working example. My problem is I can only get the form to work
how to write a jsp form using html
how to write a jsp form using html  hi, i have written the code as below... but it is showing error. please help me how to resolve it. .html file...; <body> <form method="POST" action="Form1.jsp"> EmployeeNo: <
HTML
HTML  Hi, What is the full form of HTML? Thanks   Hi, The HTML stands for HyperText Markup Language. HTML is used to create webpage for world wide web. Web pages are accessed by web browsers and then shown
web page for form registration to my department
web page for form registration to my department  I am creating web page for form registration to my department ..I have to Reprint the Application Form (i.e Download the PDf File from the Database ) , when the user gives
What is HTML web designing
What is HTML web designing Hypertext Mark-up Language (HTML) is the principal markup language for web..., lists, etc. HTML is written in the form of ‘tags’
Html
Html  in the web page if judge select the age and category then automatically under that conditions the details will be display in the form of grid give me that code in html and java

Ads