Hi, All! Let me first explain what is a structure of our J2EE Web Application: We have WAR file with following structure: /web/jsp - All JSP files /EU - End User JSP pages /SA - System Administrator JSP pages /WEB-INF web.xml - Deployment descriptor /classes - servlet + additional classes /lib - all third-party libraries /taglib - TLD files Configuration files located outside of WAR file. Application server is Tomcat 4.0.4. Here are questions: Question #1: How to point servlet to read configuration files from a relative path. As I mentioned we have configuration files outside of WAR file, so in our web.xml we have section for servlet which contains: <init-param> <param-name>AdmConf</param-name> <param-value>ABSOLUTE_PATH_TO_CONF_FILE</param-value> </init-param> It's not a problem to read config file if you have an absolute path, however when I try to put relative path (such as ../../conf/config_name), it doesn't behave properly. From my search I found that the user directory is C:\WinNT\System32. Is anyone had this kind of problem and how you solve it.
Question #2: Rigth now we're running our application from open (non WAR) mode. We've created in server.xml (Tomcat configuration file) 3 entries: 1st - points to core servlet; 2nd - points to System Administrator's entry page (JSP file); 3rd - points to End User's entry page (JSP file). If we pack everything in WAR file, the is no problem to create 1st entry since we have web.xml which tells to application service what is name and class for servlet. Problems arise with 2nd and 3rd entry. How can we point to EU and SA JSP pages that located in WAR file? Any comments/ideas will be appreciated. Thank you in advance. Alex Givant.
for question 1, the user directory is depends on from where the tomcat starts, if your tomcat starts from d:\tomcat...\bin then the user directory is d:\tomcat..\bin or if this is started as a part of windows services then user directory is c:\winnt\system32 you can try the following getServletContext().getRealPath("WEB-INF\yourFolder\yourFile.txt")