JSP Miniature probe Demo

Source: Internet
Author: User

<%@ page language= "java" import= "java.util.*" pageencoding= "UTF-8"%>
<%@ page language= "java" import= "java.io.*,java.net.*"%>
<%@ taglib prefix= "C" uri= "Http://java.sun.com/jsp/jstl/core"%>
<%@ include file= "/manager/common/common.jsp"%>


<%!
String tblwidth = "700";
String tblalign = "center";
String StrOS =system.getproperty ("Os.name");
Private String GetIP ()
{
String strtmp= "";
Try
{
Strtmp =inetaddress.getlocalhost (). gethostaddress ();
return strtmp;
}
catch (Exception e)
{
return strtmp;
}
}
Private String getsystemenv () throws Exception
{
String OS = System.getproperty ("Os.name"). toLowerCase ();
StringBuffer sb=new StringBuffer ("");
Process P=null;
if (Os.indexof ("Windows") >-1)
{
P=runtime.getruntime (). EXEC ("cmd/c set");
}
Else
{
P=runtime.getruntime (). EXEC ("/bin/sh-c set");
}
BufferedReader br=new BufferedReader (New InputStreamReader (P.getinputstream ()));
String Line;
while ((Line=br.readline ())!=null)
{
Sb.append (line+ "<br>");
}
return sb.tostring ();
}
Private String getdrivers ()
{
StringBuffer sb=new StringBuffer ("");
File roots[]=file.listroots ();
for (int i=0;i<roots.length;i++)
{
Sb.append (roots[i]+ "");
}
return sb.tostring ();
}
%>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
<title>jsp Probe </title>
<style type= "Text/css" >
<!--
Body,td,th
{
font-size:9pt;
}
Body
{
margin-left:0px;
margin-top:0px;
margin-right:0px;
margin-bottom:0px;
}
A:link
{
Text-decoration:none;
}
a:visited
{
Text-decoration:none;
}
A:hover
{
Text-decoration:none;
}
A:active
{
Text-decoration:none;
}
. STYLE4 {color: #000000}
. STYLE5 {font-weight:bold; font-size:10pt;}
. STYLE7 {Font-size:10}
-
</style>


<body>
<table align= "center" width= "277" border= "0" >
<tr>
&LT;TD width= "" align= "center" >jsp probe </td>
</tr>
</table>
<div align= "center" ><br>
<table width= "<%=tblWidth%>" align= "<%=tblAlign%>" border= "0" cellspacing= "0" cellpadding= "1" >
<tr>
&LT;TD colspan= "2" height= "bgcolor=" #E0E0E0 "><span class=" STYLE5 ">&nbsp; server basic information
</span> </td>
</tr>
<tr>
&LT;TD height= "width=" 20% ">&nbsp; server name </td>
<td>&nbsp;<%= request.getservername ()%> </td>
</tr>
<tr>
&LT;TD height= "width=" 20% ">&nbsp; domain/IP </td>
<td>&nbsp;<%= Request.getservername ()%>
<%=getip ()%> </td>
</tr>
<tr>
&LT;TD height= "" >&nbsp; Server port </td>
<td>&nbsp;<%= request.getserverport ()%> </td>
</tr>
<tr>
&LT;TD height= "All" >&nbsp; client ports </td>
<td>&nbsp;<%= request.getremoteport ()%> </td>
</tr>
<tr>
&LT;TD height= "All" >&nbsp; client IP </td>
<td>&nbsp;<%= request.getremoteaddr ()%> </td>
</tr>
<tr>
&LT;TD height= ">&nbsp;" Web Server </td>
<td>&nbsp;<%= application.getserverinfo ()%> </td>
</tr>

<tr>
&LT;TD height= ">&nbsp; os </td>
<td>&nbsp;<%= stros+ "" +system.getproperty ("sun.os.patch.level") + "Ver:" +system.getproperty (" Os.version ")%> </td>
</tr>
<tr>
&LT;TD height= ">&nbsp; server time </td>
<td>&nbsp;<%=new Date (). toLocaleString ()%> </td>
</tr>
<tr>
&LT;TD height= "" Width= "20%" >&nbsp; CPU Information </td>
<td>&nbsp;<%= system.getproperty ("Os.arch")%> </td>
</tr>
<tr>
&LT;TD height= "width=" 20% ">&nbsp; disk Partitions </td>
<td>&nbsp;<%= getdrivers ()%> </td>
</tr>
<tr>
&LT;TD height= "width=" 20% ">&nbsp; user current working directory </td>
<td>&nbsp;<%= system.getproperty ("User.dir")%> </td>
</tr>
<tr>
&LT;TD height= "All" >&nbsp; this file path </td>
<td>&nbsp;<%= Application.getrealpath (Request.getrequesturi ())%> </td>
</tr>
</table>
<br>
<table width= "<%=tblWidth%>" align= "<%=tblAlign%>" border= "0" cellspacing= "0" cellpadding= "1" >
<tr>
&LT;TD colspan= "2" height= "bgcolor=" #E0E0E0 "><span class=" STYLE4 ">&nbsp;<span class=" STYLE5 " >java Related Information </span></span> </td>
</tr>
<tr>
&LT;TD height= "width=" 20% "><span class=" STYLE7 ">&nbsp; JDK versions </span> </td>
<td>&nbsp;<%= system.getproperty ("java.version")%> </td>
</tr>
<tr>
&LT;TD height= "" Width= "20%" >&nbsp; Servlet version </td>
<td>&nbsp;<%= application.getmajorversion () + "." +application.getminorversion ()%> </td>
</tr>
<tr>
&LT;TD height= "" Width= "20%" >&nbsp; JDK Installation Path </td>
<td>&nbsp;<%= system.getproperty ("Java.home")%> </td>
</tr>
<tr>
&LT;TD height= "" Width= "20%" >&nbsp; encoding </td>
<td>&nbsp;<%= system.getproperty ("file.encoding")%> </td>
</tr>
<tr>
&LT;TD height= "" Width= "20%" >&nbsp; Java classpath </td>
<td>&nbsp;<%= system.getproperty ("Java.class.path")%> </td>
</tr>
</table>
<br>
<table width= "<%=tblWidth%>" align= "<%=tblAlign%>" border= "0" cellspacing= "0" cellpadding= "1" >
<tr>
&LT;TD colspan= "2" height= "All" bgcolor= "#E0E0E0" >&nbsp; Server environment variables &nbsp;</td>
</tr>
<tr>
&LT;TD colspan= "2" ><%= getsystemenv ()%> </td>
</tr>
</table>
<br>

</div>
</body>

JSP Miniature probe Demo

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.