In java file:
Random random = new Random();
String ranLong = String.valueOf(random.nextLong());
session.setAttribute("hiddenvalue", ranLong);// this will sets the ranLong value in to the hiddenvalue
//ranLong variable contains some 10 digit number
In jsp file:
<%
String hiddenvalue1 = (String) session.getAttribute("hiddenvalue");
%>
now send this 'hiddenvalue1' to javascript
<body onload="setValue('<%= hiddenvalue%>')">
In javascript file:
function setValue(val){
document.getElementById("tf_CheckValue").value = val;
}
Monday, June 21, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment