| Author |
How to get environment variable?
|
Rekha Pai
Ranch Hand
Joined: Oct 30, 2008
Posts: 35
|
|
Hi,
Root is running the tomcat server.
In my jsp page if I use the System.getProperty("user.name")
it gives user name as "root".
How can I get the user name who has opened the page?
Regards,
Rekha
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
You can't. The container knows about himself, his environment, his applications, incoming requests... It doesn't know about the thousand users unix/windows/other account accessing its applications.
You have to make a proper web authentication system in your application to identify your users.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Rekha Pai
Ranch Hand
Joined: Oct 30, 2008
Posts: 35
|
|
Hi,
Then is it possible to get the user name from the browser's user profile?
Regards,
Rekha
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
|
What's a browser's user profile ? Don't forget that JSP is server-side.
|
 |
Rekha Pai
Ranch Hand
Joined: Oct 30, 2008
Posts: 35
|
|
Hi,
Ok, My requirement is poping up an alert which is
user dependent. I can use cookies for that. But javascript and html page
can not give me user data. How can I do that?
So once a person logs in and opens a browser is there any way to capture
his user id?
Regards,
Rekha
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
|
No. As I said, you have to make a proper login mechanism in your application.
|
 |
Rekha Pai
Ranch Hand
Joined: Oct 30, 2008
Posts: 35
|
|
Thanks a lot.
Regards,
Rekha
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56233
|
|
|
I had already told you this in the other post that you opened. Please do not cross-post the same question in multiple forums. It wastes people's time when multiple redundant conversations take place. Please click this link ⇒ CarefullyChooseOneForum ⇐ for more information.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
 |
|
|
subject: How to get environment variable?
|
|
|