File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes servletContext getting the name of the user that's logged in Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "servletContext getting the name of the user that Watch "servletContext getting the name of the user that New topic
Author

servletContext getting the name of the user that's logged in

Jeroen Nouws
Greenhorn

Joined: Jul 14, 2011
Posts: 17
Hey,

i'm looking to get a username from a person that loggs in,
i heard you can get it from the servletContext, but don't know what method to look for
can anyone help me on my way?

cheers
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

That greatly depends upon what you mean by "logged in".


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Jeroen Nouws
Greenhorn

Joined: Jul 14, 2011
Posts: 17
i've found what i was looking for in the request.getRemoteUser();
with logging in i meant supplying a username and password to access a restricted area
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60800
    
  65

Right -- which will only work if you use container-managed authentication (as it appears you are). Not everyone does, so it's important to point that out.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: servletContext getting the name of the user that's logged in
 
Similar Threads
ServletContext
ServletContext
ServletContext object
how to call a servlet from jsf managed bean?
Getting ServletContext