Solved

Obtaining a client IP address in a JSP

Posted on 2000-02-29
4
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

726 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