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;
}
Showing posts with label JSP. Show all posts
Showing posts with label JSP. Show all posts
Monday, June 21, 2010
Tuesday, May 18, 2010
Clearing Browser Cache
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"></meta>
<meta content="no-cache" http-equiv="Cache-control"></meta>
<meta content="no-store" http-equiv="Cache-control"></meta>
<meta content="no-cache" http-equiv="Pragma"></meta>
<meta content="0" http-equiv="expires"></meta>
<%
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires", 0);
response.setHeader("Cache-Control", "no-store");
%>
<meta content="no-cache" http-equiv="Cache-control"></meta>
<meta content="no-store" http-equiv="Cache-control"></meta>
<meta content="no-cache" http-equiv="Pragma"></meta>
<meta content="0" http-equiv="expires"></meta>
<%
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Pragma", "no-cache");
response.setDateHeader("Expires", 0);
response.setHeader("Cache-Control", "no-store");
%>
Labels:
JSP
Subscribe to:
Posts (Atom)