August 1, 2011 at 3:45 PM
Here we have used MySQL database:
1)form.html:
<html>
<form method="post" action="http://localhost:8080/examples/jsp/insert.jsp">
<table>
<tr><td>First Name:</td><td><input type="text" name="fname"></td></tr>
<tr><td>Last Name:</td><td><input type="text" name="lname"></td></tr>
<tr><td>Email:</td><td><input type="text" name="email"></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass"></td></tr>
<tr><td>Confirm Password:</td><td><input type="password" name="cpass"></td></tr>
<tr><td>Date Of Birth</td><td><input type="text" name="dob"></td></tr>
<tr><td>Age:</td><td><input type="text" name="age"></td></tr>
<tr><td>Gender</td><td><input type="text" name="gender"></td></tr>
<tr><td>Address:</td><td><input type="text" name="address"></td></tr>
<tr><td>Country</td><td><input type="text" name="country"></td></tr>
<tr><td>State:</td><td><input type="text" name="state"></td></tr>
<tr><td>City</td><td><input type="text" name="city"></td></tr>
<tr><td>Telephone No:</td><td><input type="text" name="tno"></td></tr>
<tr><td>Mobile:</td><td><input type="text" name="mobile"></td></tr>
<tr><td></td><td><input type="submit" value="Submit"></td></tr>
</table>
</form>
</html>
2)insert.jsp:
<%@page import="java.sql.*,java.util.*"%>
<%
String fname=request.getParameter("fname");
String lname=request.getParameter("lname");
String email=request.getParameter("email");
String pass=request.getParameter("pass");
String cpass=request.getParameter("cpass");
String dob=request.getParameter("dob");
int age=Integer.parseInt(request.getParameter("age"));
String gender=request.getParameter("gender");
String address=request.getParameter("address");
String country=request.getParameter("country");
String state=request.getParameter("state");
String city=request.getParameter("city");
int telephone=Integer.parseInt(request.getParameter("tno"));
int mobile=Integer.parseInt(request.getParameter("mobile"));
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/roseindia", "root", "root");
Statement st=con.createStatement();
int i=st.executeUpdate("insert into student(firstname,lastname,email,pass,confirm_pass,dob,age,gender,address,country,state,city,telephone,mobile) values('"+fname+"','"+lname+"','"+email+"','"+pass+"','"+cpass+"','"+dob+"',"+age+",'"+gender+"','"+address+"','"+country+"','"+state+"','"+city+"',"+telephone+","+mobile+")");
out.println("Data is successfully inserted!");
}
catch(Exception e){
System.out.print(e);
e.printStackTrace();
}
%>
Related Tutorials/Questions & Answers:
how to insert data in database using html+jsphow to
insert data in
database using html+jsp anyone know what... and
database name. Here machine name id localhost and
database name...";
// declare a connection by
using Connection interface
how to insert data into database using jsp & retrivehow to
insert data into
database using jsp & retrive Hello,
I have created 1
html page which contain username, password & submit button. in my oracle10G
database already contain table name admin which has name, password
Advertisements
insert data in the database using checkboxinsert data in the
database using checkbox i am fetching
data from the
database using servlet on the
jsp page and there is checkbox corresponding... should i
insert only checked
data into
database on submission.
We
how to insert checkbox value into database using jsphow to
insert checkbox value into
database using jsp
How to
insert check box value to the oracle
database using jsp?
I want to create hotel's...;
Here is a simple
jsp code that
insert the selected checkbox values
how to insert checkbox value into database using jsphow to
insert checkbox value into
database using jsp
How to
insert check box value to the oracle
database using jsp?
I want to create hotel's package. where the admin will select the activities to
insert in the PACKAGE table. I
insert and delete data in databaseinsert and delete
data in database
insert and delete
data in
database from servlets through JDBC
Hi Friend,
Please visit the following links:ADS_TO_REPLACE_1
Insert Data
Delete
Data
ThanksADS_TO_REPLACE_2
how to insert data into databasse by using jdbchow to
insert data into databasse by
using jdbc â?¢ Create a Registration Form with 10 input fields
using HTML and get those inputs
using JSP and
insert those inputs into
database using JDBC.
Here is a
jsp code
how to insert data into databasse by using jdbchow to
insert data into databasse by
using jdbc â?¢ Create a Registration Form with 10 input fields
using HTML and get those inputs
using JSP and
insert those inputs into
database using JDBC.
Here is a
jsp code
how to insert data into databasse by using jdbchow to
insert data into databasse by
using jdbc â?¢ Create a Registration Form with 10 input fields
using HTML and get those inputs
using JSP and
insert those inputs into
database using JDBC.
Here is a
jsp code
how to insert data into databasse by using jdbchow to
insert data into databasse by
using jdbc â?¢ Create a Registration Form with 10 input fields
using HTML and get those inputs
using JSP and
insert those inputs into
database using JDBC.
Here is a
jsp code
insert data into databaseinsert data into database hi,thanks for reply
just i am doing... and studentmaster is the
database table name.
i am
using same details.
Now give the
data into the
jsp page that
data stored into the database.Here the error
database is connected but not insert the datadatabase is connected but not
insert the data hi,
i am getting connected to database.Retrive the
data also but cannot
insert the
data into
database. i am
using msaccess2007.my inserstudententry.jsp code is follows,pls help me
Insert XML file data to databaseInsert XML file
data to
database
In this tutorial, you will learn
how to
insert the xml file
data to
database
using dom parser.
You all are aware of XML... to read the xml file
data and save the values
of an XML file to a
Database Insert file data into databaseInsert file
data into
database
In this section, you will learn
how to
insert.... Now to
insert this
data into the
database, we have
established a
database connection. Then
using the
insert query, we have inserted
whole file
data unable to insert data into database unable to
insert data into
database hello.i have a problem in inserting
data into database.i have used two prepared statement.one for retrieving the eid based on ename and the other is inserting
data into
database based
unable to insert data into database unable to
insert data into
database hello.i have a problem in inserting
data into database.i have used two prepared statement.one for retrieving the eid based on ename and the other is inserting
data into
database based
unable to insert data into database unable to
insert data into
database hello.i have a problem in inserting
data into database.i have used two prepared statement.one for retrieving the eid based on ename and the other is inserting
data into
database based
unable to insert data into database unable to
insert data into
database hello.i have a problem in inserting
data into database.i have used two prepared statement.one for retrieving the eid based on ename and the other is inserting
data into
database based
To insert maximum number of data in database.To
insert maximum number of
data in
database.
how to change string
data type into clob
data type in
jsp
Hi Friend,
Please visit the following link:ADS_TO_REPLACE_1
http://www.roseindia.net/jdbc/
insert-clob
Insert text file data into DatabaseInsert text file
data into
Database
In this section, you will learn
how to
insert the text file
data into the
database. For this purpose, we have created... the
data to the ArrayList.
This list is then iterated through the Iterator
insert date into database using jsfinsert date into
database using jsf Hello
I need a simple example of source code to
insert a date into a
database using jsf
what do I have to put in backing bean and page jsf ( i need juste a date )
thanks
insert data into databaseinsert data into database type Exception report
message...)Go to the start->Control Panel->Administrative Tools->
data sources.
2... selecting the driver, click finish button.
4)Then give
Data Source Name
how to insert array data into sql server using jsphow to
insert array
data into sql server
using jsp hello,
i have problem to
insert array
data into my sql server from
jsp form. beloW is my code... from form, but not
insert into my sql
database.
try {
//String
Insert Data into Database Using Hibernate Native SQL Insert Data into
Database Using Hibernate Native SQL...
how you can use Native SQL with hibernate. You will learn
how to use Native to
insert data into
database. Native SQL is handwritten SQL for all
database