Hi ,here is my code....
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.Calendar"%><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>My Sample Program</title>
<script>
function getTime(){
<%Calendar cal=Calendar.getInstance();%>
var minute=<%cal.get(Calendar.MINUTE);%>
var second=<%cal.get(Calendar.SECOND);%>
alert(minte+":"+second);
}
</script>
</head>
<body>
<form name="myForm" onsubmit="getTime()">
<h1 >Hi</h1>
<br>
<input type="submit" value="SUBMIT">
</form>
</body>
</html>
my problem is, suppose if i run this code at 9 am for the first time after deploying its giving the correct time(alert). Once the
jsp is compiled
the next time on wards if i am running this code i am getting alert which gives me the time at which it has run previously. So what could be the mistake in this approach to get the server time from the javascript .
Thanks in advance,
CRB.