problem in inserting data in databases created in netbeans using jsp..
i am trying to make a virtual classroom website in jsp using netbeans.i created table inside netbeans through sql editor.and tried to make a login page whose details are saved into that database.used ur code
1)register.jsp:
<html>
<form method="post" action="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();
}
%>
everything goes fine but the values are not updated in the table. what to do? plz help?
View Answers
Related Tutorials/Questions & Answers:
Advertisements
Problem in inserting clob data in jspProblem in
inserting clob
data in jsp how to insert any rich text editor
data (which have more than 32766 characters) in a clob type column of oracle database with
jsp problem on jsp, inserting data into table(mysql).problem on
jsp,
inserting data into table(mysql). hello friends, I have a
problem in jsp.I want to insert
data, which is given by user through... is in mysql.I want to use placeholder("?") to insert
data into table.Plsssss help
jsp using netbeansjsp using netbeans Code to access and manage multiple e-mail accounts on the same page.. user should be able to edit mail accounts' link as required
Inserting data on a database in servlet - JSP-ServletInserting data on a database in servlet Hi
I am following... to a databse by a servlet.I used the example in "
Inserting Data In Database table... of a table,that is none of the
data which i tried to enter into database by
using help me in inserting data into db using hibernatehelp me in
inserting data into db
using hibernate How to insert
data into dependent tables through hybernate
Hi Friend,
Please visit the following link:
http://www.roseindia.net/hibernate/insert-
data-database.shtml
problem in jsp using ms-accessproblem in
jsp using ms-access after starting server(tomcat) wen v...)Your DSN will get
created.
6) Restart your server and run your
jsp code.
Here... will get
created.
6) Restart your server and run your
jsp code.
Here is your
Problem in enctype="multipart/form-data" in JSPProblem in enctype="multipart/form-
data" in JSP im
using a page which is in
JSP. i have some text boxes and one upload button. i want to load the file itself when i click the submit button. im
using enctype="multipart/form-
data jdbc and swing problem in netbeansjdbc and swing
problem in netbeans i reteived the table from database in a jdbc program.
next i want to do is place the table as it is in a jpanel.. i am
using netbeans IDE
can u tel me how to do that one?? urgent
jdbc and swing problem in netbeansjdbc and swing
problem in netbeans i reteived the table from database in a jdbc program.
next i want to do is place the table as it is in a jpanel.. i am
using netbeans IDE
can u tel me how to do that one?? urgent
inserting value - JSP-Servlet;
Inserting form
data into database
using JSP and ServletGiven code will illustrate you, how one can get
data into database
using JSP and ServletExample Code... that will insert the HTML form
data into database
using JSP and Servlet
Inserting Data into mysql - SQLInserting Data into mysql My sincere apologize for this post. I noticed there is no category for php. However am hoping my question will fit... (
using php)and
inserting the details in a mysql database. Lets take for instance
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
reading data using struts and jsp javareading
data using struts and
jsp java how can i read
data entered by user into a textbox (
jsp page) into struts action class ex emp id,so... employee related
data To create an web application using netbeans IDETo create an web application
using netbeans IDE Hi,
I'm a beginner in java and I have
created an
jsp code for entering the username password... to write a java code for
inserting my values in to the database...
Thank you
inserting data into datafieldsinserting data into datafields I was raised with a query....
there is a button, on click on it....... few fields regenerates and
the details entered there should be inserted into Database
Number of times we click that button
get data between date using jsp with msaccessget
data between date
using jsp with msaccess hi, urgently i need program for get
data between date
using jsp with MsAccess database.plz any one can help me.thanks for anyone replay with regards c.b.chellappa
jsp problemjsp problem Hi every one plz give me answer for below question ASAP
I
created one
JSP(used pre defined javascript in
jsp to get rtf format in browser) which creats RTF Format in browser to enter
data.
MY question is after i
oracle connectivity problem with netbeansoracle connectivity
problem with netbeans sir I am
using oracle window version +net bean6.8.
jam trying to connect net bean to oracle. for this after adding new driver(ojdbc6.jar) in services tab I got connectivity with oracle
Accessing Jqxgrid data in Controller layer using JSPAccessing Jqxgrid
data in Controller layer
using JSP I am
using Keyboard Navigation jqxgrid. I am able to bind the grid by passing
data from controller layer
using JAVA. What i actually require is to fetch the
data which
Exporting data from mysql into csv using jspExporting
data from mysql into csv
using jsp Hi friends.... I want to export the
data from mysql to csv file
using... i am having 30 columns in my database.. Eg- text1,text2,text3,....,upto text30... i want to export this
data Fetch the data using jsp standard actionFetch the
data using jsp standard action I want the code of fetch the
data from the database & show in a
jsp page
using jsp:usebean in MVC model... that retrieves the
data from the database through java bean and display it in
jsp page
How to get data from Oracle database using JSP problem in
jsp in the sense to get
data from the database like oracle . I have...
data from the database like oracle), I have
created one
jsp program like... the answer to retrieve
data from the database by
using servlet or
jsp program
JSP Problem - JSP-ServletJSP Problem Hi,
I have
problem,this is my senario
I have one
jsp,this
jsp having the 3 fields.let me take 3fields userName,emailAddress... by
using the "AddUser" button.when ever i click on "Submit" button the
data should go
jsp problemjsp problem
problem::::::::
On
JSP form ,when i insert
data in text field........at that time action is perform and
data is retriev from
data base and get assign to other field on that form........
when
data is assign to other
Retrieve data from databse using where in JSPRetrieve
data from databse
using where in JSP Hi, can somebody help me?
I have a
jsp page. in that i want to get
data from the database where username is matched. i tried it. but can't get the output.
here is the code. please
Delete and edit data in xml file using JSPDelete and edit
data in xml file
using JSP I want to know how to delete and edit
data from an XML file by use of
JSP.
I have XML file having tasks... that i can delete
data.
For exmple
JSP pae will have text box where ill enter