Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP and System properties.

 
vivek sivakumar
Ranch Hand
Posts: 187
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well this is my small bean which is supposed to get the system user name in my jsp page but what happens is that every time my jsp page loads it gives an exeption that there is "no property associated with parameter systprop" im a bit confused about this!!! here is my code..
import java.lang.*;
import java.io.*;
import java.lang*;
public class Winuser {
String systprop= "bean" ;
public String getWinuse()
{
systprop = System.getProperty("user.name");
return systprop; }
}
WHAT IS THE PROBLEM IN MY CODE, according to bean specs it says that if the beam is used for read only then its enough that there is only one get method???
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17622
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It wouldn't have helped anyway. All you'd see is the user ID of your server login. This is a property of the local JVM.
Web users don't have user IDs unless they're authenticated, and even then the "user id" depends on what sort of authentication scheme you have. It's not like logging into a LAN.
 
vivek sivakumar
Ranch Hand
Posts: 187
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wowwwww!!! mgnificient tim!! thats what is the difference between a novice like me and a experienced people like u!!
yes i got the same problem , it is giving me the root user name !!! Please tell me if javascript could work properly here to get the system user name! but this code works perfectly , with this code i get the user name correctly here goes my code..
The code below works fine but why not for jsp pages??
Tim as u said in jsp it gets the server log on???
why???
______________________________________________________________
class win{
public static void main(String args[]){
String sys = System.getProperty("user.name");
System.out.println(sys);
}
}
PRINTS CORRECTLY MY user name.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic