value is inserted into the sql table through jsp-jdbc but not getting stored into the data base,only row is increasing.

Ads
 

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:
value is inserted into the sql table through jsp-jdbc but not getting stored into the data base,only row is increasing.
value is inserted into the sql table through jsp-jdbc but not getting stored into the data base,only row is increasing.  <html> <..."> <title>JSP Page</title> <style type
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
the last data entered into database is getting stored again after refreshing
the last data entered into database is getting stored again after refreshing  hey all i made a shout box using php and mysql but the last data... if the data is deleted from the database the last data entered is getting posted plz help
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
how to select the row value that was retrived from the database ?
how to select the row value that was retrived from the database ?  I am getting the data's from the table that was stored in database. Now in the page in which i am getting all the data from the database has an another select
how to select the row value that was retrived from the database ?
how to select the row value that was retrived from the database ?  I am getting the data's from the table that was stored in database. Now in the page in which i am getting all the data from the database has an another select
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
Convert the excel sheet data into oracle table through java or jsp
Convert the excel sheet data into oracle table through java or jsp  Hi Friends, Let me help this issue i am phasing Convert the excel sheet data into oracle table through java or jsp
how to display the selected row from the data table in model panel ??
how to display the selected row from the data table in model panel ?? ...:dataTable value="#{tableRecordBean.dataList}" var="dataItems" onRowClick="#{rich...="350"> <f:facet name="caption"> <h:outputText value
how insert data from databse in array and compare new data to already stored value in array
how insert data from databse in array and compare new data to already stored value in array   hello all i tried to fetch data from databse and try to stored it in an array and i want to compare new value that come from database
Getting the last inserted id using jsp
Getting the last inserted id using jsp  Pls how can i retrieve the last inserted id after submitting a form to mysql using jsp
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
how to retrieve data from table with runtime values in sql?
how to retrieve data from table with runtime values in sql?  how to retrieve data from table with runtime values in sql? For example, I have table... value. But I dont know how to retrieve the values whenever i pass different dates
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
Adding button to each row for the table and adding row to another table
Adding button to each row for the table and adding row to another table  Hi I need to add button to each line in the table(Table data is retrived... row of the table
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
upload the text file through html and insert those data into the table
upload the text file through html and insert those data into the table  i want to take input form a text file.there is a table in database oracle... into table.now i want to upload the text file through html and insert those data
How to import data from sql server table into an excel file by creating the rows dynamically in the excel according to the dataabase??
How to import data from sql server table into an excel file by creating... data from sql server table into an excel file by creating the rows dynamically in the excel according to the dataabase?? There is a table in sql server having
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
delete row from a table in hibernate
delete row from a table in hibernate  is there method to delete row in a table using hibernate like save(-) to insert row
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

Ads