JSP code:
<html>
<head><title>Hello World</title></head>
<body>
Hello World!<br/>
<%
out.println("Your Host IP address is " + request.getRemoteHost()+"</br>");
out.println("Your Addr address is " + request.getRemoteAddr()+"</br>");
out.println("Your Port Post address is " + request.getRemotePort()+"</br>");
%>
</body>
</html>
Use http://127.0.0.1:8081/hello.jsp gets the result:
Hello World!
Your Host IP address is 0:0:0:0:0:0:0:1
Your Addr address is 0:0:0:0:0:0:0:1
Your Port Post address is 32432
Use http://localhost:8081/hello.jsp gets the result:
Hello World!
Your Host IP address is 0:0:0:0:0:0:0:1
Your Addr address is 0:0:0:0:0:0:0:1
Your Port Post address is 32432