default.jsp
来自「采用j2ee架构做的bbs」· JSP 代码 · 共 274 行
JSP
274 行
<%@page pageEncoding="gb2312"%>
<%@page contentType="text/html;charset=gb2312" %>
<%@include file="admin_top.jsp" %>
<%@ page import="java.util.*,java.io.*,javax.servlet.*,javax.servlet.http.*,java.lang.*" %>
<%
long timePageStart = System.currentTimeMillis();
%>
<%
class EnvServlet
{
public long timeUse=0;
public Hashtable htParam=new Hashtable();
private Hashtable htShowMsg=new Hashtable();
public void setHashtable()
{
Properties me=System.getProperties();
Enumeration em=me.propertyNames();
while(em.hasMoreElements())
{
String strKey=(String)em.nextElement();
String strValue=me.getProperty(strKey);
htParam.put(strKey,strValue);
}
}
public void getHashtable(String strQuery)
{
Enumeration em=htParam.keys();
while(em.hasMoreElements())
{
String strKey=(String)em.nextElement();
String strValue=new String();
if(strKey.indexOf(strQuery,0)>=0)
{
strValue=(String)htParam.get(strKey);
htShowMsg.put(strKey,strValue);
}
}
}
public String queryHashtable(String strKey)
{
strKey=(String)htParam.get(strKey);
return strKey;
}
public long test_int()
{
long timeStart = System.currentTimeMillis();
int i=0;
while(i<3000000)i++;
long timeEnd = System.currentTimeMillis();
long timeUse=timeEnd-timeStart;
return timeUse;
}
public long test_sqrt()
{
long timeStart = System.currentTimeMillis();
int i=0;
double db=(double)new Random().nextInt(1000);
while(i<200000){db=Math.sqrt(db);i++;}
long timeEnd = System.currentTimeMillis();
long timeUse=timeEnd-timeStart;
return timeUse;
}
}
%>
<%
EnvServlet env=new EnvServlet();
env.setHashtable();
String action=new String(" ");
String act=new String("action");
if(request.getQueryString()!=null&&request.getQueryString().indexOf(act,0)>=0)action=request.getParameter(act);
%>
<html>
<head>
<style>.PicBar { background-color: #0022ff; border: 1px solid #000000; height: 12px;}</STYLE>
<script language="javascript">
function showsubmenu(sid)
{
whichEl = eval("submenu" + sid);
if (whichEl.style.display == "none")
{
eval("submenu" + sid + ".style.display=\"\";");
eval("txt" + sid + ".innerHTML=\"<a href='#' title='关闭此项'><font face='Wingdings' color=#FFFFFF>x</font></a>\";");
}
else
{
eval("submenu" + sid + ".style.display=\"none\";");
eval("txt" + sid + ".innerHTML=\"<a href='#' title='打开此项'><font face='Wingdings' color=#FFFFFF>y</font></a>\";");
}
}
</SCRIPT>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="1" class="tableBorder">
<tr>
<td height="25" align="center" bgcolor="#f58200" onclick="showsubmenu(0)" background="../images/skin/1/bg_td.gif"><font color=#FFFFFF><strong>服务器相关参数</strong></font><a href="#top" title="返回顶部"><font face='Webdings' color=#FFFFFF>5</font></a> <span id=txt0 name=txt0><a href='#' title='关闭此项'><font face='Wingdings' color=#FFFFFF>x</font></a></span></td>
</tr>
<tr>
<td style="display" id='submenu0'><table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor="#0000ff">
<tr bgcolor="#FFFFFF" height="22">
<td width="130" class="Forumrow"> 服务器名</td>
<td colspan="3" height="22" class="Forumrow"> <%= request.getServerName() %>(<%=request.getRemoteAddr()%>)</td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td class="Forumrow"> 服务器操作系统</td>
<td colspan="3" class="Forumrow"> <%=env.queryHashtable("os.name")%> <%=env.queryHashtable("os.version")%>
<%=env.queryHashtable("sun.os.patch.level")%></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td class="Forumrow"> 服务器操作系统类型</td>
<td class="Forumrow"> <%=env.queryHashtable("os.arch")%></td>
<td class="Forumrow"> 服务器操作系统模式</td>
<td class="Forumrow"> <%=env.queryHashtable("sun.arch.data.model")%>位</td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td class="Forumrow"> 服务器所在地区</td>
<td class="Forumrow"> <%=env.queryHashtable("user.country")%></td>
<td class="Forumrow"> 服务器语言</td>
<td class="Forumrow"> <%=env.queryHashtable("user.language")%></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td class="Forumrow"> 服务器时区</td>
<td class="Forumrow"> <%=env.queryHashtable("user.timezone")%></td>
<td class="Forumrow"> 服务器时间</td>
<td class="Forumrow"> <%=new java.util.Date()%> </td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td class="Forumrow"> 服务器解译引擎</td>
<td width="170" class="Forumrow"> <%= getServletContext().getServerInfo() %></td>
<td width="130" class="Forumrow"> 服务器端口</td>
<td width="170" class="Forumrow"> <%= request.getServerPort() %></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td height="22" class="Forumrow"> 当前用户</td>
<td height="22" class="Forumrow"> <%=env.queryHashtable("user.name")%></td>
<td height="22" class="Forumrow"> HTTP解译引擎</td>
<td height="22" class="Forumrow"> <%=request.getProtocol()%></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td class="Forumrow"> 用户目录</td>
<td colspan="3" class="Forumrow"> <%=env.queryHashtable("user.dir")%></td>
</tr>
</table></td>
</tr>
</table>
<br>
<table border="0" cellpadding="0" cellspacing="1" class="tableBorder">
<tr>
<td height="25" align="center" bgcolor="#f58200" onclick="showsubmenu(1)" background="../images/skin/1/bg_td.gif"><font color=#FFFFFF><strong>JAVA相关参数</strong></font><a href="#top" title="返回顶部"><font face='Webdings' color=#FFFFFF>5</font></a><span id=txt1 name=txt1><a href='#' title='关闭此项'><font face='Wingdings' color=#FFFFFF>x</font></a></span></td>
</tr>
<tr>
<td style="display" id='submenu1'><table border=0 width=100% cellspacing=1 cellpadding=3 bgcolor="#0000ff">
<tr bgcolor="#fcc79b" height="22">
<td width="30%" class="Forumrow"> 名称</td>
<td width="50%" class="Forumrow" height="22"> 英文名称</td>
<td width="20%" class="Forumrow" height="22"> 版本</td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td width="30%" class="Forumrow"> JAVA运行环境名称</td>
<td width="50%" height="22" class="Forumrow"> <%=env.queryHashtable("java.runtime.name")%></td>
<td width="20%" height="22" class="Forumrow"> <%=env.queryHashtable("java.runtime.version")%></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td width="30%" class="Forumrow"> JAVA运行环境说明书名称</td>
<td width="50%" height="22" class="Forumrow"> <%=env.queryHashtable("java.specification.name")%></td>
<td width="20%" height="22" class="Forumrow"> <%=env.queryHashtable("java.specification.version")%></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td width="30%" class="Forumrow"> JAVA虚拟机名称</td>
<td width="50%" height="22" class="Forumrow"> <%=env.queryHashtable("java.vm.name")%></td>
<td width="20%" height="22" class="Forumrow"> <%=env.queryHashtable("java.vm.version")%></td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td width="30%" class="Forumrow"> JAVA虚拟机说明书名称</td>
<td width="50%" height="22" class="Forumrow"> <%=env.queryHashtable("java.vm.specification.name")%></td>
<td width="20%" height="22" class="Forumrow"> <%=env.queryHashtable("java.vm.specification.version")%></td>
</tr>
<%
float fFreeMemory=(float)Runtime.getRuntime().freeMemory();
float fTotalMemory=(float)Runtime.getRuntime().totalMemory();
float fPercent=fFreeMemory/fTotalMemory*100;
%>
<tr bgcolor="#FFFFFF" height="22">
<td height="22" class="Forumrow"> JAVA虚拟机剩余内存:</td>
<td height="22" colspan="2" class="Forumrow"><img align=absmiddle class=PicBar width='<%=0.85*fPercent%>%'> <%=fFreeMemory/1024/1024%>M
</td>
</tr>
<tr bgcolor="#FFFFFF" height="22">
<td height="22" class="Forumrow"> JAVA虚拟机分配内存</td>
<td height="22" colspan="2" class="Forumrow"><img align=absmiddle class=PicBar width='85%'> <%=fTotalMemory/1024/1024%>M
</td>
</tr>
</table></td>
</tr>
</table>
<br>
<table border="0" cellpadding="0" cellspacing="1" bgcolor="#f58200" class="tableBorder">
<tr>
<td height="25" align="center" bgcolor="#f58200" onclick="showsubmenu(4)" background="../images/skin/1/bg_td.gif"><font color="#FFFFFF"><strong>服务器连接速度</strong></font><a href="#top" title="返回顶部"><font face='Webdings' color=#FFFFFF>5</font></a> <span id=txt4 name=txt4><a href='#' title='关闭此项'><font face='Wingdings' color=#FFFFFF>x</font></a></span></td>
</tr>
<tr>
<td bgcolor="#F8F9FC" style="display" id='submenu4'> <table width="100%" border="0" cellspacing=1 cellpadding=3 bgcolor="#0000ff">
<tr bgcolor="#FFFFFF">
<td width="80" class="Forumrow">接入设备</td>
<td width="420" class="Forumrow"> 连接速度(理想值)</td>
<td width="100" class="Forumrow">下载速度(理想值)</td>
</tr>
<tr bgcolor="#FFFFFF">
<td class="Forumrow">56k Modem</td>
<td class="Forumrow"><img align=absmiddle class=PicBar width='1%'> 56 Kbps</td><td class="Forumrow"> 7.0 k/s</td>
</tr>
<tr bgcolor="#FFFFFF">
<td class="Forumrow">64k ISDN</td>
<td class="Forumrow"><img align=absmiddle class=PicBar width='1%'> 64 Kbps</td><td class="Forumrow"> 8.0 k/s</td>
</tr>
<tr bgcolor="#FFFFFF">
<td class="Forumrow">512k ADSL</td>
<td class="Forumrow"><img align=absmiddle class=PicBar width='5%'> 512 Kbps</td><td class="Forumrow"> 64.0 k/s</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="19" class="Forumrow">1.5M Cable</td>
<td class="Forumrow"><img align=absmiddle class=PicBar width='15%'> 1500 Kbps</td><td class="Forumrow"> 187.5 k/s</td>
</tr>
<tr bgcolor="#FFFFFF">
<td class="Forumrow">5M FTTP</td>
<td class="Forumrow"><img align=absmiddle class=PicBar width='50%'> 5000 Kbps</td><td class="Forumrow"> 625.0 k/s</td>
</tr>
<tr bgcolor="#FFFFFF">
<td class="Forumrow">当前连接速度</td>
<%
if(action.equals("SpeedTest"))
{
out.println("<script language='JavaScript'>var tSpeedStart=new Date();</script>") ;
out.println("<!--\n");
for(int i=0;i<1000;i++)
{out.println("####################################################################################################");}
out.println("-->\n");
out.println("<script language='JavaScript'>var tSpeedEnd=new Date();</script>\n");
out.println("<script language='JavaScript'>");
out.println("var iSpeedTime=0;iSpeedTime=(tSpeedEnd - tSpeedStart) / 1000;");
out.println("if(iSpeedTime>0) iKbps=Math.round(Math.round(100 * 8 / iSpeedTime * 10.5) / 10); else iKbps=10000 ;");
out.println("var iShowPer=Math.round(iKbps / 100);");
out.println("if(iShowPer<1) iShowPer=1; else if(iShowPer>82) iShowPer=82;");
out.println("</script>\n");
out.println("<script language='JavaScript'>") ;
out.println("document.write('<td class=Forumrow><img align=absmiddle class=PicBar width=\"' + iShowPer + '%\">' + iKbps + ' Kbps');");
out.println("</script>\n");
out.println("</td><td class=Forumrow> <a href='?action=SpeedTest' title=测试连接速度><u>");
out.println("<script language='JavaScript'>");
out.println("document.write(Math.round(iKbps/8*10)/10+ ' k/s');");
out.println("</script>\n") ;
out.println("</u></a></td>");
%>
<script>
txt5.innerHTML="网速测试完毕!"
testspeed.style.visibility="hidden"
</script>
<%
}
else
{out.println("<td class=Forumrow></td><td class=Forumrow> <a href='?action=SpeedTest' title=测试连接速度><u>开始测试</u></a></td>");}
%>
</tr>
</table></td>
</tr>
</table>
<%
long timePageEnd = System.currentTimeMillis();
long timePageUse=timePageEnd-timePageStart;
%>
</body>
<%@include file="admin_foot.jsp" %>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?