Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in with Tomcat 5.0 to run jsp

 
ranjeet amancha
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Im using Tomcat 5.0 to run my jsp 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 System.getProperty("user.name"); in a java class 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
Tiijnar
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 applet or a web start application.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic