How to refresh JSP page automatically after each time period?
<%@ page import="java.io.*,java.text.*,java.util.*"%>
<html>
<head>
<title>Auto Refresh Header Example</title>
</head>
<body>
<h2>Auto Refresh Header Example</h2>
<%
// Page will be auto refresh after 1 second
response.setIntHeader("Refresh", 1);
// Get Current Time
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Calendar cal = Calendar.getInstance();
out.println(dateFormat.format(cal.getTime()));
%>
</body>
</html>
Comments
Post a Comment