web form(html) with jdbc

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









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... to client side. Web Form or HTML form is very flexible and it can have many input
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...({});   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
html form - Java Beginners
html form  Hi, I wnt to design a form with more than one action in submit button.thanks. regards, sakthi  Hi friend, You specify your main requirement of form with more then one action. Thanks
HTML form - Java Beginners
HTML form   Hi, thank u for fast reply. I have two forms (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
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
html - JDBC
html  How to insert a new column into HTML (or jsp) table dynamically? i have to print a table of html depending on number of subjects (where subjects are retrieved from Oracle)? I retrieved values from Oracle through
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
HTML form methods GET and POST
HTML form methods GET and POST  What is the difference between the HTML form methods GET and POST
HTML - JDBC
HTML  I created on html page with two comboboxes. when ever i select one value in first combobox then immediately in the second combo box values... combobox. please send me code of html   Hi Friend, To do
html form - Java Beginners
html form  Hi
Handling multiple buttons in HTML Form
Handling multiple buttons in HTML Form  How to handle Handling multiple buttons in HTML Form
html form - JSP-Servlet
html form  how to retrieve database value in dropdown list box placed in html form  Hi friend, Visit for more information. http://www.roseindia.net/jsp/ Thanks
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 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
HTML form example
language, which runs on the web browser. The HTML form is used in dynamic web...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>
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
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
dynamic web pages in html
dynamic web pages in html  How to create Dynamic web pages in HTML
Copy text file in a HTML form.
Copy Text File in a HTML form For copying a text file from one source to other destination in HTML form, you will have to create a HTML form and call the form...,$destinationfile); } ?>  Draw the HTML form <!DOCTYPE HTML PUBLIC
Opening a file in a HTML form
Opening a file in a HTML form In this example, you will first see that a form has been created in HTML format and the code of opening a file has been written separately.  First create a HTML form and call the php action file to open
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
JSP:HTML Form in-place Editing - JSP-Servlet
JSP:HTML Form in-place Editing  Hi, I want to thank the people... developer's needs. This is a follow up to the HTML Form in-place editing. The code works fine when I've incorporated it in my web application, its really
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
JSP:HTML Form in-place Editing - JSP-Servlet
JSP:HTML Form in-place Editing  I have an HTML form (form #1) which... beans. Perhaps you guys are better aware of in-place html form editing than me...). Now my purpose is to re-populate the same customer form (form #1) based
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
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
PHP HTML Form
PHP & HTML Form: In the current tutorial we will study about PHP and HTML form, we will see how to send HTML . We will combine one html file and PHP... Exaplanation: In the above HTML file we create a HTML form and send the data
HTML Code for registration form
HTML Code for registration form Here is an example of Registration form using... to take the input for the user. The most basic and frequently used form is the HTML... basic form of the HTML from. We can use the JavaScript to validate the user
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: <
to store form vaues in database - JDBC
to store form vaues in database  sir i have created one form with two fields. 1.name 2.father name if we enter the values to these fields in textboxea the data must be stored in MYSQLdatabase please provide
PHP HTML Form Submit Button
Topic : HTML FORM SUBMIT BUTTON Part - 4 The another part which is important... of the tutorial then our Html form has covered the action and method attribute.... The Submit button in Html is used to submit form data to the page mentioned
Uploading file in servlet from a html form
Uploading file in servlet from a html form  Sir, I want to upload a picture from my html file and save it to my database as BLOB,but what JAR should i use for this purpose i am really confused about.And also is it possible to do
HTML code to servlet to database using jdbc
HTML code to servlet to database using jdbc  pls send me the code..._TO_REPLACE_1 1)form.html: <html> <form method="post" action="http://localhost... { String msg=req.getParameter("msg"); res.setContentType("text/html
HTML(Registration form) to Jsp to stored into MS ACCESS database
HTML(Registration form) to Jsp to stored into MS ACCESS database  i am sending one html file that contain 18 fields these are stored in ms-access... you for waiting that code. This is My Html page Link
how to update values of a html form into an excel table using java servlets?
how to update values of a html form into an excel table using java servlets?  i have written a java servlet program, which has a html form to be filled. after filling the form the servlet generates a receipt and the values should
how to load values of html form into an excel table using java servlet?
how to load values of html form into an excel table using java servlet?   i have written a java servlet program, which has a html form to be filled. after filling the form the servlet generates a receipt and the values should
Visual web JSF - JDBC
Visual web JSF  can anybody tell me that how to insert data in mysql...; } RequestBean1.java String username; String url="jdbc:mysql://localhost... url="jdbc:mysql://localhost:3306/online research framework and library"; Plz
How to retrieve array values from html form to jsp?
How to retrieve array values from html form to jsp?  Hi! I am... it into jsp. Means i just want to retrieve values from html form containing array..., To get an array values from the html form you can use the getParameterValues

Ads