Run this JSP Web page in the server segment to display the server address and refresh Time:
<%@ Page Language="Java"Import="java.util.*"pageencoding="gb2312"%>Prevent garbled generation<HTML> <Head><Metahttp-equiv= "content-type"content= "text/html; charset=utf-8"> <title>Tomcat 1</title></Head><Body> <H2>This page runs on: Tomcat 1</H2><H3>
Display Server Address: Intranet Address:<%out.println (request.getlocaladdr ()+ " : " +Request.getlocalport ()+"<br>");%></H3> <Div> <H3>Refresh Time:<spanID= "time"> </span> </Div> </Body><Scriptsrc= "js/jquery-3.2.1.min.js"></Script> <Script> vartime ; time=MyTime (); $("#time"). HTML (time); functionmytime () {var now=NewDate ();//Creating Objects var year=now.getfullyear ();//Get year varMonth=Now.getmonth ()+1;//Get Month varDate=now.getdate ();//get the time of day varhours=now.gethours ();//gets the number of hours varminutes=now.getminutes ();//Get minutes varseconds=now.getseconds ();//Get seconds var day=Now.getday ();//get the Day of the week if(now.getday ()==0) day="Sunday"; if(now.getday ()==1) day="Monday"; if(now.getday ()==2) day="Tuesday"; if(now.getday ()==3) day="Wednesday"; if(now.getday ()==4) day="Thursday"; if(now.getday ()==5) day="Friday"; if(now.getday ()==6) day="Saturday"; varClock= year+"years"+Month+"Month"+Date+"Day"+hours+":"+minutes+":"+seconds+" "+day ;//Add //document.write ("the Current system time is:" +clock); returnclock;//setTimeout (' myrefresh () ', +); }</Script> </HTML>
JSP Web page showing server address and refresh time