Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get environment variable?

 
Rekha Pai
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Rekha Pai
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Then is it possible to get the user name from the browser's user profile?

Regards,
Rekha
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's a browser's user profile ? Don't forget that JSP is server-side.
 
Rekha Pai
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No. As I said, you have to make a proper login mechanism in your application.
 
Rekha Pai
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot.

Regards,
Rekha
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64985
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic