Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8423977
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T03:52:03+00:00 2026-06-10T03:52:03+00:00

I have a web application and for that I want to capture the IP

  • 0

I have a web application and for that I want to capture the IP address of the clients who are accessing my website so that I can know what region is the most accessing the application. I am using Java EE in my application.

Probably there is some solution if we talk about header and when request is sent from the end-user.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T03:52:04+00:00Added an answer on June 10, 2026 at 3:52 am

    Use method getRemoteAddr() from interface ServletRequest or methods getHeaders() form interface HttpServletRequest:

    HttpServletRequest httpRequest = (HttpServletRequest) request;
    String userIpAddress = httpRequest.getHeader("X-Forwarded-For");
    

    There’s one caution for using the method getRemoteAddr:

    Sure you can use the method and in general case you will get IP of client. However, the method is useless if an user is behind a proxy. In this case you’ll get the proxy server’s IP address and not the client. But the proxy may include the requesting client IP in a special HTTP header. So to retrieve real-client-IP call method getHeader("X-Forwarded-For").

    An example usage in JSP:

    Use set value of IP address in session using JSTL:

    <c:set var="userIp" value="${requestScope.header('x-forwarded-for')}" scope="session" />
    

    And then get this value from the session in a convenient place.

    In JSP you can use <c:out value="${sessionScope.userIp}" /> or in servlet as session.getAttribute('userIp');

    Please read docs:

    java.lang.String getRemoteAddr() returns the Internet Protocol (IP) address of the client or last proxy that sent the request.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application that I want to run some system tests on,
I have a web application that I want to sync with Flickr. I don't
I have a .Net web application that I want to take a copy of
I have a google web application project that I want to host on github.
I have a web application that will be used on iPhones, and want to
i have a web application for video uploading,In that i want to show the
In my web application I have taken a ajax calendar in that i want
I have a SQL and VS 2008 web application that I need to capture
I have C# web application that I want it to send out an email
I have a web application (WAR) that I want to deploy in Tomcat 5.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.