value is inserted into the sql table through jsp-jdbc but not getting stored into the data base,only row is increasing.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
<style type="text/css">
<!--
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 18px;
}
-->
</style>
</head>
<body>
<p>Â </p>
<p>Â </p>
<p>Â </p>
<p>Â </p>
<table width="498" height="177" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#666666">
<tr>
<td width="184" height="51"> <div align="center" class="style1">
<div align="justify">NAME </div>
</div></td>
<td width="187"><label>
<input type="text" name="textfield" size="30">
</label></td>
</tr>
<tr>
<td height="48" class="style1"> <div align="justify">EMAIL</div></td>
<td><input name="textfield2" type="text" size="30"></td>
</tr>
<tr>
<td height="39"><div align="justify" class="style1">PASSWORD</div></td>
<td><input name="textfield3" type="text" size="30"></td>
</tr>
<tr>
<td height="39">Â </td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
<h1>Â </h1>
<form action="http://localhost:8080/WebApplication1/faces/jsp1.jsp">
<%@page language="java" %>
<%@ page import ="java.sql.*" %>
<% String name=request.getParameter("textfield");
String email=request.getParameter("textfield2");
String password=request.getParameter("textfield3");
try{
//String query ="INSERT INTO demodb VALUES('"+name+"','"+email+"','"+password+"')";
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn=DriverManager.getConnection("jdbc:oracle:thin:@Nayna-PC:1521:orcl","scott","tiger");
//Statement stmt=conn.createStatement();
PreparedStatement ps=conn.prepareStatement("insert into demodb(name,email,password) values(?,?,?)");
ps.setString(1,name);
ps.setString(2,email);
ps.setString(3,password);
int rs=ps.executeUpdate();
//conn.close();
if(rs!=0){
System.out.println("successful");
}
else{
System.out.println("unsuccessful");
}
}
catch(Exception e){
System.out.println("error in connection"+e);
}
%>
</form>
</body>
</html>
View Answers
Ads
Related Tutorials/Questions & Answers:
Deleting a Row from SQL Table Using EJB
Deleting a
Row from
SQL Table Using EJB
 ... to delete a
row from the
SQL Table. Find out the steps given below that describes
how to delete a particular
row from the database
table using EJB. The steps
Advertisements
Insert Data in Table Using Stored Procedure
Insert
Data in
Table Using
Stored Procedure ...
data into a
table
using
stored procedure.
Steps:
1.Create database... been
inserted into
table.
Download the source code
discussed
Delete row and column from table through java code
Delete
row and column from
table through java code... will see how to delete
row and
column from given
table through java code. Java code... will delete the
row having minimum
value of ID then delete the column named
Deleting a Row from SQL Table Using EJB
Deleting a
Row from
SQL Table Using EJB... are
going to delete a
row from the
SQL Table. Find out the steps given below...
=====================================
Data updated successfully : See
sql table to verify
SQL add column default value
SQL add column default
value
Add a Column default
value is used in
SQL, When create statement
Query is performed in
SQL .Usually, the default
value
Why you are not getting value from your data science?
Why you are not
getting value from your
data science? Hi,
I am... for
the tutorials to learn:
Why you are not
getting value from your
data science?
Try...;Why you are not
getting value from your
data science?". Also tell me which
add image in a row of table
add image in a
row of table i have a
table in which i have to add... a label in which instead of passing text i have
inserted image using jLabel.setIcon(new ImageIcon("E:/2.jpg"));.But when i pass this jlabel in the
row it shows
add image in a row of table
add image in a
row of table i have a
table in which i have to add... a label in which instead of passing text i have
inserted image using jLabel.setIcon(new ImageIcon("E:/2.jpg"));.But when i pass this jlabel in the
row it shows
SQL Out Parameter
SQL Out Parameter
SQL Out Parameter allows the
stored procedure to the pass
data... parameter allows the
stored procedure to pass the
value
and pass back to the invoker
same data inserted 2 times in database
same
data inserted 2 times in database pls help me,
i have
table studentmaster(firstname,lastname,fathername,phone,address).
i am inserting
data into database 2 times the
data will be
inserted.
forexample:
firstname
same data inserted 2 times
same
data inserted 2 times thanks for reply,
i know the insert command. but same
data inserted 2 times.where is the problem i cannot understood
use struts 1.0 to view sql table value on JSP page
use struts 1.0 to view
sql table value on
JSP page Here i am using struts 1.0 to view my
sql table values on
jsp page. But the problem is when i append the
value in bean then i find the last
row of
table is shown repetedly. Any
use struts 1.0 to view sql table value on JSP page
use struts 1.0 to view
sql table value on
JSP page Here i am using struts 1.0 to view my
sql table values on
jsp page. But the problem is when i append the
value in bean then i find the last
row of
table is shown repetedly. Any
SQL Alter Column Default Value
SQL Alter Column Default
Value
Alter Column Default
Value in
SQL Server is used with Create
Table Statement. The default
value will be set as per specified
Retriving data stored in database
Retriving
data stored in database Hi,
How to retrive
data from my
sql database using Hibernate,Spring and tapestry please give me an example.I am new to this Hibernate and Spring
SQL add column default value
into
the
table. The Stu_Class takes the default
value of 10,when no
value is
inserted...
SQL add column default
value
Add a Column default
value is used in
SQL, When create
MySQL Append Data
;
This example illustrates how to append
data with a column
value.
'CONCAT()' function is used to append
data to the column
value...;studentid" column for each
row of the "mca"
table.
Table
JavaScript add row to table
JavaScript add
row to
table
 ...' and 'td'. As you already know that 'td' contains the
table data and
'tr 'defines...(document.createTextNode()) adds the text node to the 'td' element as the
table data. Then we