Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Tim Cooke
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
Saloon Keepers:
  • Piet Souris
Bartenders:

javascript to jsp(i am sorry to post it once again please see the code i have everything ut does not

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
<!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>
 
Sheriff
Posts: 67762
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please do not post the same question more than once. Continue any discussion in your original post.

Be sure to use code tags to keep your code formatted, and be sure to completely describe your problem.
 
    Bookmark Topic Watch Topic
  • New Topic