Solved

Obtaining a client IP address in a JSP

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
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…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

760 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

18 Experts available now in Live!

Get 1:1 Help Now