Apply Auto Refresh funtionality in JSP | Implement Automatic refresh JSP page after a givem time

Hi Everyone in my project there was requirment of Automatic refresh of JSP page after a 5 Second
I have applied below logic in JSP Page

Code :

<% // Set refresh, autoload time as 5 seconds
 response.setIntHeader("Refresh", 5); 
 // Get current time , for testing of current time display
 Calendar calendar = new GregorianCalendar(); 
 String am_pm; int hour = calendar.get(Calendar.HOUR); int minute = calendar.get(Calendar.MINUTE); int second = calendar.get(Calendar.SECOND); if(calendar.get(Calendar.AM_PM) == 0) am_pm = "AM"; else am_pm = "PM"; String CT = hour+":"+ minute +":"+ second +" "+ am_pm; out.println("Crrent Time: " + CT + "\n");
 %>

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.