A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Problem in with Tomcat 5.0 to run jsp
Joined: Dec 17, 2008
Dec 22, 2008 03:27:00
5.0 to run my
which contains the code to get windows username.
out.println("Username : "+System.getProperty("user.name"));
out.println("Username : "+System.getenv("username"));
Output of the above code is
Username : SYSTEM Username : null
If I use the same code is run using Tomcat 5.5 then I get correct output.
I also came to know that If I use
then I get correct output(No need of Tomcat).
But in my application I got to use JSP. I even tried for calling java method(which returns username with System.getProperty())in a JSP, after that also I get the wrong output.
Can any one tell me why Im getting this problem?
Is this problem related to versions of Tomcat?
Thanks in advance
Joined: Oct 08, 2006
Dec 22, 2008 08:22:00
No, it's not a problem related to Tomcat.
You expected the Java code to run at the client machine, but it doesn't. It runs at the server machine. That's your misinterpretation here.
If you want to get the client's user name by System.getProperty(), then you obviously need to run Java at the client machine. You can do this using a signed
or a web start application.
I agree. Here's the link:
subject: Problem in with Tomcat 5.0 to run jsp
How to do this ?? anyone has a sample code?
How to get environment variable?
Very Simple JSP problem
Display User's Login Name from Client Machine's Environment Variable
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015