Okay now, lemme explain the real problem. I have to load a properties file from a bean.This bean is called from the jsp page. The properties file is in the same folder as the jsp page.But how do I get the correct path in the bean to load the property file. If I call the System.getProperty("user.dir"), it gives me the path to the folder before the jsp page.(Not the one where the jsp is).My jsp lies in the following path - c:\\prgram files\allaire\JRun\servers\default\time and the path returned by System.get... is c:\\program files\JRun\servers\default . I don't want to add the folder Time to the path in the code b'coz it may change in different environments. I have a jsp which is in directory c:\\...default\ccsd. From this jsp, I call a bean interface which returns the System.getProperty("user.dir"). The returned value is - c:\\....\default instead of c:\\...\default\ccsd. I cannot understand the logic behind it. JRun 3.0 is being used.
[This message has been edited by Celina Joseph (edited August 30, 2001).]
ummm....that probably the root dir of your web application. haven't tried it, so partly guessing... Am I right? Please let me know what the root of your application is.... just curious... regds. - satya
I wouldn't even try it. In fact, I think a lot of systems will return a null object, depending on how the server was started and the rest would return something unique to the server - and it MIGHT even change unpredictably as the server processes different requests. It's not really appropriate here. You're better off starting from a known absolute reference point, which you can pass in as a server parameter.
An IDE is no substitute for an Intelligent Developer.
Y'know, on reflection, there's a larger issue here. You really shouldn't put control information in a location from which content can be served. Bad Guys like to dig around the normal access mechanisms and abuse your hard work. If you put the properties file in the classes directory you can use the java Resource functionality to access it without having to know its absolute location.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: What should System.getProperty("user.dir") return when called from a bean ?