Solved

Obtaining a client IP address in a JSP

Posted on 2000-02-29
4
209 Views
Last Modified: 2012-06-27
Has anyone any idea on the way to get the client IP address when running a Java Server Page (JSP) ? I've looked at the java.net.InetAddress class and it looks good, but all I get is the server's IP address. The solution musyt work for both IE and Netscape.

Thanks in advance !
0
Comment
Question by:gng
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
fontaine earned 200 total points
ID: 2568574
Invoke the getRemoteAddr() method on the request object available to your JSP file.

String remoteIP = request.getRemoteAddr();
0
 
LVL 3

Expert Comment

by:terajiv
ID: 2571589
Hi fontaine
can u pl. tell me this method belongs to which class ?
0
 
LVL 5

Expert Comment

by:fontaine
ID: 2571653
Hello Terajiv,

The request object is an instance of HttpServletRequest. HttpServletRequest extends ServletRequest. The getRemoteAddr() method belongs to ServletRequest.

Bertrand
0
 
LVL 3

Expert Comment

by:terajiv
ID: 2571759
Thanx fontaine...
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
difference of if loops 23 62
hibernate insert example 13 34
how to see all occupied ports on windows 10 laptop 15 76
hibernate example issues from command prompt 10 50
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question