popprem wrote: > > Hi, > > I'v really stuck with an issue. I have done a web program using struts > framework. I have a plugin class there for which i have to pass a > configuration file as parameter. That file is in webapps/Myapp/WEB-INF/ > directory. So i mentioned relative path as > ../webapps/Myapp/WEB-INF/conf.xml. it works fine if i download tomcat zip > file & extract it & use. Bt if i download a .exe file (eg: > Apache-tomcat-5.5.15.exe) & run it to install & use it, struts doesnt get > that path. > > I'm really stuck with this prob. i need a way to specify path which works > for both tomcat installations. > > Please help me to solve this prob. > > Note: > I thought to check where a file creates if i create a file from my program. > When the tomcat.zip is used i found the created test file is in bin > directory of tomcat. That means tomcat defaultly points to bin directory, so > the path to the config file ../webapps/Myapp/WEB-INF/conf.xml. works fine. > When i used tomcat.exe & installed tomcat in my machine & run the program,i > found that the test file i created in my code level was in windows/system32/ > directory. so in this case tomcat doesnt defaultly points to the bin > directory i guess. > > hope this helps to give me a good answer. > Thanks in advance. > > > Check the docs for your plugin to see if there's any other way of expressing the path to your config file. The standard method of reading any file in a webapp is to use ServletContext.getResourceAsStream() to get an input stream and then use that to read the file. Doing that, the path would be "/WEB-INF/conf/.xml". I'd be surprised of a Struts plugin doesn't accept something like that.
--David --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org