Hello everyone, i am new comer to web development & netbeans, i m a student.
I have been given a task to create registration page with username & password, & after submitting this form it automatically stores data into databse, which can later be seen by admin only...or can be used for retrievel of data for login purpose.
I have created 1 form in JSP netbeans with both username,password text field inputs . & also installed Mysql into Netbeans & connected it & created 1 database with table columns username,password (in which i want to store data of entered by user while registrating)
I know its simple task for u guys, but i'm nascent in programming,coding,developing...so guys please help me out..give code for this & also tell where to write this code. & how to connect tht form to my databse , so it can store data?
August 8, 2011 at 12:06 PM
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();
}
%>
Related Tutorials/Questions & Answers:
how to insert data from netbeans into databsehow to
insert data from
netbeans into databse
how to
insert data from
netbeans into
databse
Please visit the following link:
http://www.roseindia.net/webservices/web-services-database.shtml
Advertisements
JSP code for registration formJSP code for
registration form Haiiii
can u please tell me
how to encrypt password field in
registration form and to compare both password and confirm password fields using
jsp 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...; password is correct or not...if correct then it goes to another
page insert data into mysql databse using swinginsert data into mysql
databse using swing
Blockquote
hi,
here is my code,
i want code for store
data into mysql database when click on submit button from access
data from this
form,
please provide code,
import java.awt.
creating web page for form registrationcreating 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... number and date of birth or Email Address .
How to do the Post Action . Can
how to insert data in database using html+jsphow to
insert data in database using html+jsp anyone know what... = null;
// declare a resultset that uses as a table for output
data from... table.
String QueryString = "
insert into xxqc_announcement(PID,msg
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
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
web page for form registration to my departmentweb
page for
form registration to my department 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
Registration FormRegistration Form Hi Friends
I am Working on a small project.I have to create a
Registration page using MVC pattern where i have to
insert data username,password,date of birth,Mobile number number into database.
How to
insert How do I compile the registration form?How do I compile the
registration form?
How do I compile the
registration form as stated at the bottom of the following
page (URL is below). Do I...://www.roseindia.net/struts/hibernate-spring/user-
registration-action.shtml
how to insert, retrieve data from,to db(code)....how to
insert, retrieve
data from,to db(code).... Hi.....
i ve created login
page n in that a
registration form also....
my doubt is-when.../javascriptpagerefresh.shtml
http://www.roseindia.net/
jsp/user-
registration-
form-using-jsp.shtml
Search page form in jspSearch
page form in jsp search
form in
jsp
Please go through the following links:
http://www.roseindia.net/
jsp/user-search.shtml
http://www.roseindia.net/servlets/search.shtml
how to insert, retrieve data from,to db(code)....how to
insert, retrieve
data from,to db(code).... Hi, i have created login
page n in that a
registration form also in
jsp, my doubt is-when new user...://www.roseindia.net/
jsp/user-
registration-
form-using-jsp.shtml
User Registration Form Using JSP(JspBeans)
User
Registration Form Using
JSP(JspBeans)
... of
user
registration form using
jsp. One of the basic programming tactics.... It will not
only provide basic
data validation for the
registration information input
insert , edit , and delete button in one jsp pageinsert , edit , and delete button in one
jsp page hello
I want to ask about the way of creating a
jsp page contains
insert , edit , and delete buttons and manipulate
data in database directly.
any help please or hints
how to create a login page and registration page?how to create a login
page and
registration page? hellow,
pls tell me the code for
how we can create a login
page and
registration page and
how we can store the info in database.only in advance java as
jsp how to get data in jsp page - Frameworkhow to get
data in
jsp page Hi List[],
I to get the
data in
jsp page by calling mxml file using FDS.
Please give example to me... to enclose a set of MXML tags in a
JSP page. You can set any number
multipart/form-data - JSP-Servletmultipart/
form-data When we are uploading a file we are using the encoded type of
form of type
multipart/
form-
data. When we are using... with the example available in
http://www.roseindia.net/
jsp/file_upload/Sinle
How to insert clob data??How to
insert clob
data?? Can any one tell me in details
how... to
insert more than 4000 characters.I have heard that clob fields can hold 4 gb of
data and need pl/sql to avail that feature.Can any one tell me
how to create