Hi,
To get windows username Im using the following code.
If I execute the above java class I get the windows username correct.
But when I use it in jsp like-
I get the ouput as-
" Windows Username : SYSTEM "
I tried to call the "getUser()" in jsp using an object of "GetWindowUsern ame"
but even after that I got same output.
Im running the above jsp using Apache Tomcat 5.0 on my server machine.
When I run the same code on my local system using eclipse & Apache Tomcat v5.5, I get the output correct.
Can anyone solve my problem.
Thanks in advance
Tiijnar
To get windows username Im using the following code.
Code:
public class GetWindowUsername { public String getUser() { String userName = System.getProperty("user.name"); System.out.println("Window's Username: "+userName); return userName; } } public class TestUserName { public static void main(String args[]) { GetWindowUsername g = new GetWindowUsername(); String s = g.getUser(); System.out.println("UserName : "+s); } }
But when I use it in jsp like-
Code:
<% String s = System.getProperty("user.name"); out.println("Windows Username : "+s); %>
" Windows Username : SYSTEM "
I tried to call the "getUser()" in jsp using an object of "GetWindowUsern ame"
but even after that I got same output.
Im running the above jsp using Apache Tomcat 5.0 on my server machine.
When I run the same code on my local system using eclipse & Apache Tomcat v5.5, I get the output correct.
Can anyone solve my problem.
Thanks in advance
Tiijnar
Comment