[原创]jsp调用net包获得对方ip机器名
<HTML><HEAD>
<TITLE>Who Am I?</TITLE>
<%@ import ="java.net.*" %>
</HEAD>
<BODY>
<%
InetAddress localHost = InetAddress.getLocalHost();
Date localTime = new Date();
%>
<H1>
Who Am I?
</H1>
I am called <%= localHost.getHostName() %> (<%= localHost.getHostAddress() %>).<br>
This page last executed at <%= localTime.toString() %>.
</BODY>
</HTML>