<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery Example 3</title>
<script type="text/javascript" language="javascript" src="resources/prototype_1.6.0.3/jquery-1.2.6.js"></script>
<script type="text/javascript" language="javascript" src="resources/prototype_1.6.0.3/jquery.validate.js"></script>
<script type="text/javascript" language="javascript">
//Our validation script will go here.
<!--
$(document).ready(function(){
//validation implementation will go here.
$("#TestForm").validate({
rules: {
txtFirstName: {
required: true
},
txtLastName: {
required: true,
minlength: 2
},
txtSpouseName: {
required: true
},
txtGender: {
required: true
},
txtAddress: {
required: true,
minlength: 10
},
txtMobileno: {
required: true,
minlength: 10
},
txtEmail: {
required: true
}
},
messages: {
txtFirstName: {
required: "* Required"
},
txtLastName: {
required: "* Required",
minlength: "* 2 Characters Required."
},
txtSpouseName: {
required: "* Required"
},
txtGender: {
required: "* Required"
},
txtAddress: {
required: "* Required",
minlength: "* 2 Characters Required."
},
txtMobileno: {
required: "* Required",
minlength: "* 2 Characters Required."
},
txtEmail: {
required: "* Required"
}
}
});
})
function myfunction()
{
var outString = "basic.jsp?x1=" +txtFirstName
outString += "&y1=" +txtFirstName
outString += "&x2=" +txtFirstName
outString += "&y2=" +txtFirstName
location.href = outString
}
</script>
<style type="text/css">
#container {
width: 350px;
height: 8em;
border: 1px #009933 solid;
background-color:#66FF66;
display:block;
}
label, input{
margin:2px 0px 1px 4px;
}
label {
margin-top:3px;
font-family:"Times New Roman", Times, serif;
font-size:1.1em;
}
</style>
</head>
<body>
<div id="container">
<form id="TestForm">
<label for="txtFirstName">First Name: </label><br />
<input name="txtFirstName" type="text" id="txtFirstName" title="Please Enter a First Name" /><br />
<label for="txtLastName">Last Name:</label><br />
<input name="txtLastName" type="text" id="txtLastName" title="Pleaes Enter a Last Name"/><br />
<label for="txtSpouseName">Spouse Name: </label><br />
<input name="txtSpouseName" type="text" id="txtSpouseName" title="Please Enter a First Name" /><br />
<label for="txtGender">Gender: </label><br />
<input name="txtGender" type="text" id="txtGender" title="Please Enter a First Name" /><br />
<label for="txtAddress">Address: </label><br />
<input name="txtAddress" type="text" id="txtAddress" title="Please Enter a First Name" /><br />
<label for="txtMobileno">Mobile No: </label><br />
<input name="txtMobileno" type="text" id="txtMobileno" title="Please Enter a First Name" /><br />
<label for="txtEmail">Email: </label><br />
<input name="txtEmail" type="text" id="txtEmail" title="Please Enter a First Name" /><br />
<input type="button" value="Submit" onclick="myfunction()" />
</form>
</div>
</body>
</html>
basic .jsp
<%--
Document : basic
Created on : Mar 10, 2009, 4:17:00 PM
Author : dinesh
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<%
try {
String x1 = request.getParameter("x1");
String y1 = request.getParameter("y1");
String x2 = request.getParameter("x2");
String y2 = request.getParameter("y2");
out.println(x1 +""+ y1+"" + x2+"" + y2);
} catch (Exception e) {}
%>
</body>
</html>