Registration

Ads
 

Registration

View Answers

May 14, 2008 at 6:03 PM

hi friend,

<html>
<title>registration form in jsp</title>
<head>

<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){



if(theForm.user_name.value==""){

//Please enter username

alert("Please enter User Name.");

theForm.user_name.focus();

return false;

}



if(theForm.lastname.value==""){

//Please enter lastname

alert("Please enter Last Name.");

theForm.lastname.focus();

return false;

}

if(theForm.email.value==""){
alert("Please enter email!");
theForm.email.focus();
return false;
}
if(!checkEmail(theForm.email.value)){
theForm.email.focus();
return false;
}

if(theForm.position.value==""){

//Please enter position

alert("Please enter Position.");

theForm.position.focus();

return false;

}
if(theForm.salary.value==""){

//Please enter salary

alert("Please enter salary.");

theForm.salary.focus();

return false;

}

return true;
}
</script>
</head>

<body>

<table border="1" width="50%" bgcolor="pink">
<tr>
<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%">
<tr>
<td width="50%"><b>User Name:</b></td>
<td width="50%"><input type="text" name="user_name" size="20"/> </td>
</tr>
<tr>
<td width="50%"><b>Last Name:</b></td>
<td width="50%"><input type="text" name="lastname" size="20"/> </td>
</tr>
<tr>
<td width="50%"><b>Email:</b></td>
<td width="50%"><input type="text" name="email" size="20"/> </td>
</tr>
<tr>
<td width="50%"><b>Position:</b></td>
<td width="50%"><input type="text" name="position" size="20"></td>
</tr>
<tr>
<td width="50%"><b>Salary:</b></td>
<td width="50%"><input type="text" name="salary" size="20"></td>
</tr>
</table>
<p><input type="submit" value="Submit" name="submit">
<input type="reset" value="Reset" name="reset"></p>

</form>
</td>
</tr>
</table>

</body>

</html>

May 14, 2008 at 6:04 PM

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

<%
Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName ="amar";
String password="amar123";
try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,userName,password);
try{
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+"')");

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

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

%>

--------------------------

read for more information,

http://www.roseindia.net/jsp/

Ads









Related Tutorials/Questions & Answers:
course registration
course registration  project for course registration system in java programming
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
Advertisements
REGISTRATION OF MBEAN
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 frnds...am 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
ModuleNotFoundError: No module named 'registration'
ModuleNotFoundError: No module named 'registration'  Hi, My Python... 'registration' How to remove the ModuleNotFoundError: No module named 'registration' error? Thanks   Hi, In your python
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
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
ModuleNotFoundError: No module named 'automatron-registration'
ModuleNotFoundError: No module named 'automatron-registration'  Hi...: No module named 'automatron-registration' How to remove the ModuleNotFoundError: No module named 'automatron-registration' error? Thanks   
ModuleNotFoundError: No module named 'automatron-registration'
ModuleNotFoundError: No module named 'automatron-registration'  Hi...: No module named 'automatron-registration' How to remove the ModuleNotFoundError: No module named 'automatron-registration' error? Thanks   
ModuleNotFoundError: No module named 'cubicweb-registration'
ModuleNotFoundError: No module named 'cubicweb-registration'  Hi...: No module named 'cubicweb-registration' How to remove the ModuleNotFoundError: No module named 'cubicweb-registration' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-registration'
ModuleNotFoundError: No module named 'django-registration'  Hi, My... named 'django-registration' How to remove the ModuleNotFoundError: No module named 'django-registration' error? Thanks   Hi
ModuleNotFoundError: No module named 'django-registration'
ModuleNotFoundError: No module named 'django-registration'  Hi, My... named 'django-registration' How to remove the ModuleNotFoundError: No module named 'django-registration' error? Thanks   Hi
ModuleNotFoundError: No module named 'djangorestframework-registration'
ModuleNotFoundError: No module named 'djangorestframework-registration' ...: ModuleNotFoundError: No module named 'djangorestframework-registration' How to remove the ModuleNotFoundError: No module named 'djangorestframework-registration'
ModuleNotFoundError: No module named 'edc-registration'
ModuleNotFoundError: No module named 'edc-registration'  Hi, My... named 'edc-registration' How to remove the ModuleNotFoundError: No module named 'edc-registration' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'hanyang_registration'
ModuleNotFoundError: No module named 'hanyang_registration'  Hi...: No module named 'hanyang_registration' How to remove the ModuleNotFoundError: No module named 'hanyang_registration' error? Thanks   Hi
ModuleNotFoundError: No module named 'image_registration'
ModuleNotFoundError: No module named 'image_registration'  Hi, My... named 'image_registration' How to remove the ModuleNotFoundError: No module named 'image_registration' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'itk-registration'
ModuleNotFoundError: No module named 'itk-registration'  Hi, My... named 'itk-registration' How to remove the ModuleNotFoundError: No module named 'itk-registration' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'matrix-registration'
ModuleNotFoundError: No module named 'matrix-registration'  Hi, My... named 'matrix-registration' How to remove the ModuleNotFoundError: No module named 'matrix-registration' error? Thanks   Hi
ModuleNotFoundError: No module named 'napari-registration'
ModuleNotFoundError: No module named 'napari-registration'  Hi, My... named 'napari-registration' How to remove the ModuleNotFoundError: No module named 'napari-registration' error? Thanks   Hi
ModuleNotFoundError: No module named 'napari-registration'
ModuleNotFoundError: No module named 'napari-registration'  Hi, My... named 'napari-registration' How to remove the ModuleNotFoundError: No module named 'napari-registration' error? Thanks   Hi
ModuleNotFoundError: No module named 'opps-registration'
ModuleNotFoundError: No module named 'opps-registration'  Hi, My... named 'opps-registration' How to remove the ModuleNotFoundError: No module named 'opps-registration' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'stem-registration'
ModuleNotFoundError: No module named 'stem-registration'  Hi, My... named 'stem-registration' How to remove the ModuleNotFoundError: No module named 'stem-registration' error? Thanks   Hi, In your

Ads