M
MattC
I am working in a Struts web based J2EE environment. My application is
packaged as a web app.
I have application level configuration information that needs to be
kept in a properties file. My problem is how to programmatically
determine the absolute pathname of that properties file.
It seems to me I have two basic options.
1.) I can create the properties file and put it in a "known" location.
For instance the WEB-INF\classes directory. In order to do this I will
need to determine the absolute path name to the WEB-INF directory. For
instance it might be C:\myproject\public_html\WEB-INF. How can I
determine the absolute pathname of the WEB-INF directory?
2.) I can store a relative pathname of the properties file in the
web.xml file. This is a more flexible implementation and so it is
preferred over option #1. In order to do this I need to determine the
physical location of the WEB-INF directory as in option #1. In addition
I need to gain access to the web.xml file.
Can someone tell me how to access the web.xml file from a Struts
application? In other words, I don't have access to the servlet.init()
method and its associated ServletConfig object.
Thanks,
Matt
packaged as a web app.
I have application level configuration information that needs to be
kept in a properties file. My problem is how to programmatically
determine the absolute pathname of that properties file.
It seems to me I have two basic options.
1.) I can create the properties file and put it in a "known" location.
For instance the WEB-INF\classes directory. In order to do this I will
need to determine the absolute path name to the WEB-INF directory. For
instance it might be C:\myproject\public_html\WEB-INF. How can I
determine the absolute pathname of the WEB-INF directory?
2.) I can store a relative pathname of the properties file in the
web.xml file. This is a more flexible implementation and so it is
preferred over option #1. In order to do this I need to determine the
physical location of the WEB-INF directory as in option #1. In addition
I need to gain access to the web.xml file.
Can someone tell me how to access the web.xml file from a Struts
application? In other words, I don't have access to the servlet.init()
method and its associated ServletConfig object.
Thanks,
Matt