Archive for JSP

JSP – How to get IP address of client machine

Monday, April 27th, 2009

Remote IP address of the client can get from request object of JSP. This method will return the IP address of the machine that is accessing web server through the web browser.

<%@ page contentType="text/html; charset=iso-8859-1" language="java"  %>
<%
  String ipAddress=request.getRemoteAddr();
%>
<html>
<head>
<title>IP Address of remote client machine in JSP</title>
</head>

<body>
IP Address of Client <%=ipAddress%>
</body>
</html>