Solved

Obtaining a client IP address in a JSP

Posted on 2000-02-29
4
202 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
get weblogic logged in user in java 2 58
Java Jpanels and Jframe 8 28
custom annotations 9 32
servlet doXXX methods 3 37
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now