request.getRemoteUser() is used to get the username someone has used to log in to your website. You probably get the null because you do the request before someone has logged in.
You can always use request.getRemoteAddr() to get the visitors ip at any time.
If you stored the name of the user in a session you can also use session.getAttribute("user or whatever you called it when you put it in the session"
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.