Share on Google+Share on Google+

2 Answer(s)      9 years ago
Posted in : Ajax
View Answers

May 14, 2008 at 6:03 PM

hi friend,

<title>registration form in jsp</title>

<script type="text/javascript">

function checkEmail(email) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){
return (true)
alert("Invalid email address.Please Enter again.")
return (false);

function validateForm(theForm){


//Please enter username

alert("Please enter User Name.");


return false;



//Please enter lastname

alert("Please enter Last Name.");


return false;


alert("Please enter email!");;
return false;
return false;


//Please enter position

alert("Please enter Position.");


return false;


//Please enter salary

alert("Please enter salary.");


return false;


return true;


<table border="1" width="50%" bgcolor="pink">
<td width="100%">
<form method="POST" action="RegistrationAction.jsp" onsubmit="return validateForm(this);">

<h2 align="center">User registration form</h2>
<table border="1" width="100%">
<td width="50%"><b>User Name:</b></td>
<td width="50%"><input type="text" name="user_name" size="20"/> </td>
<td width="50%"><b>Last Name:</b></td>
<td width="50%"><input type="text" name="lastname" size="20"/> </td>
<td width="50%"><b>Email:</b></td>
<td width="50%"><input type="text" name="email" size="20"/> </td>
<td width="50%"><b>Position:</b></td>
<td width="50%"><input type="text" name="position" size="20"></td>
<td width="50%"><b>Salary:</b></td>
<td width="50%"><input type="text" name="salary" size="20"></td>
<p><input type="submit" value="Submit" name="submit">
<input type="reset" value="Reset" name="reset"></p>




May 14, 2008 at 6:04 PM

<%@ page language="java" import="java.sql.*" %>

Connection con = null;
String url = "jdbc:mysql://";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName ="amar";
String password="amar123";
con = DriverManager.getConnection(url+db,userName,password);
Statement st = con.createStatement();
String username=request.getParameter("user_name");
String lastname=request.getParameter("lastname");
String email=request.getParameter("email");
String position=request.getParameter("position");
String salary=request.getParameter("salary");

int val = st.executeUpdate("insert user_Register values(id,'"+username+"','"+lastname+"','"+email+"','"+position+"','"+salary+"')");

out.println("successfully insert data into database!");

catch (SQLException ex){
System.out.println("SQL statement is not executed!");
catch (Exception e){



read for more information,


Related Tutorials/Questions & Answers:
course registration
course registration  project for course registration system in java programming
registration application
registration application  How to develop a registration application in struts which has seperate file for database connection and data checking and form and action
Registration Form
Registration 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
Registration - Ajax
Registration  i want to create a registration page. in which User... me on this topic. How i can connect this registration page to data base. i am...;hi friend, registration form in jsp function checkEmail(email
REGISTRATION OF MBEAN  my question is... i have installed jboss, and created a managed Bean(MBEAN)and provided interface and everything. but i dont know whether the service registerd in jmx or not. please suggest me
user registration
user registration  hi working on a project in JSP.i want to create a user registration form with username,password,mail id and check box option for community selection.once the details are registered i want to save
to creating a registration form
to creating a registration form  how to create a registration form
registration form
registration form  Hii.. I have to design one registration page in java that looks like REGISTER USERNAME (here i have to check whether username already exists in database) EMAIL ADDRESS (here i have to check whether
Registration Form in HTML
Registration Form in HTML  User Registration Form in HTML - i wanted to design a user registration form in HTML. So, Can anyone please guide me or give me a peace of code to design a user registration form in HTML. Thanks
popup registration form
popup registration form  hi i want a code for popup registration form.when user click a button popup form will appear.thanks.
user registration example
user registration example  hello roseindia i'm searching for a user registration application/example using struts can you pls help me
JSP code for registration form
JSP 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
form registration on JavaScript
form registration on JavaScript   i want form of registration on JavaScript > < check the name is string or number & if the name number output error >> and the same of email and birthday and country >> <
Login form and registration
Login form and registration  I need a complete code for ligin and new user registration form and validation
registration key - Java Beginners
registration key  I want the serial key for JCreator Pro 4.50. I lost it. If any body has it please send
AJAX REGISTRATION FORM  I have implemented user name, check and state selection using ajax, in the html registration form. I am loading two XML... either username or state. How to implement both in same registration form could any
Sip Registration - MobileApplications
Sip Registration  I need to registration with sip server using j2me. i use the code of jsr180. but it didnt work. is there any help to register with cordia using j2me? opu
Login & Registration - JSP-Servlet
Login & Registration  Pls tell how can create login and registration step by step in servlet. how can show user data in servlet and how can add and remove user only in servlet.   Hi Friend, Please visit
Domain Registration Guide
and test your website. Domain Name Registration Guide This guide
to create registration form
to create registration form  hello friends,im student and i want to do an assignment on to create an registration form with 20 input fields by using...://
Registration page with JavaScript Validation
Registration page with JavaScript Validation   HTML Registration page with JavaScript Validation - required source code   Registration page in HTML with JavaScript Validation source code <html> <head>
JDBC Connection and Registration
stored in database. How to validate user registration. Thanks in advance...); } } } Validate User Registration
student registration example
student registration example  1.reg.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>... visit the following links:
Domain Registration Guide
Domain Registration Guide What is Domain? Internet is the large network of computers. On the Internet there should be some way to identify the computers. Domain name is the solution for this. Domain Name is the unique name
Spring MVC User Registration example
Spring MVC User Registration example  hi, I am unable to find springMVCUserRegistration example full code can u send me full code of this example   Please visit the following link: Spring MVC USer Registration
user Registration form using bean
user Registration form using bean   In this code,password and confirm password does n't matches.Every time an error occured if i entered same string for both.Please help to sort my problem
how to create a user registration form in php
how to create a user registration form in php  how to create a user registration form in php
Registration timer expired, but client is still registering!
Registration timer expired, but client is still registering!  Registration timer expired, but client is still registering
creating web page for form registration
creating 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 Download the PDf File from the Database ) , when the user gives the Application
An Analytical Approach to Optimizing Parallel Image Registration/Retrieval
An Analytical Approach to Optimizing Parallel Image Registration/Retrieval  how to do


Advertisement null