The JSP page uses JavaScript to get the system time, as follows:
- <%@ page language= "java" import= "java.util.*" pageencoding= "Utf-8"%>
- <%
- String path = Request.getcontextpath ();
- String basepath = request.getscheme () + "://" +request.getservername () + ":" +request.getserverport () +path+ "/";
- %>
- <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" >
- <base href= "<%=basePath%>" >
- <title>SysTime-www.cxybl.com</title>
- <meta http-equiv= "Pragma" content= "No-cache" >
- <meta http-equiv= "Cache-control" content= "No-cache" >
- <meta http-equiv= "Expires" content= "0" >
- <meta http-equiv= "keywords" content= "keyword1,keyword2,keyword3" >
- <meta http-equiv= "description" content= "This are my page" >
- <script language= "JavaScript" type= "Text/javascript" >
- function ShowTime () {
- var now=new Date;
- document.getElementById ("DD"). Innerhtml=now.getfullyear ()
- + "Year" + (Now.getmonth () +1)
- + "Month" +now.getdate ()
- + "Day" +now.gethours ()
- + ":" +now.getminutes () + ":" +now.getseconds ();
- SetTimeout ("ShowTime ()", "1000");
- }
- </script>
- <body onload= "ShowTime ()" >
- <div id=dd></div>
- </body>