Hi,

I had a problem similar to yours, and here is how I solved it:
1. made a Struts PlugIn (a class that implements
org.apache.struts.action.PlugIn) and has a method init(ActionServlet ,
ModuleConfig) and a String property (let's say configFileName). The
property will be automatically set by Struts at startup, and then the
init(...) method will be called.
2. in the init(...) method I read the file: 
InputStream is =
actionServlet.getServletContext().getResourceAsStream(configFileName);
3. the config file name is set from the struts-config.xml as follows:
    <plug-in className="mypackage.MyPlugIn">
        <set-property value="/WEB-INF/config.xml" property="configFileName"/>
    </plug-in>

This should work for you, too. Good luck! :-)


On Fri, 05 Nov 2004 17:28:25 +0100, Morkeleb <[EMAIL PROTECTED]> wrote:
> Hi.
> 
> I want to make a static class which access a configuration file in /WEB-INF/.
> I tried <Classname>.class.getResourceAsStream("/WEB-INF/config-file.xml"); 
> but it wont work.
> So I thought I have to do it by using getServletConfig().getServletContext( 
> ).getResourceAsStream("/WEB-INF/config-file.xml")
> but I did not figure out how to do that because getServletCofig only works in 
> Servlets, not in static beans.
> 
> Can you help me?
> 
> Thanx in Advance,
> Lukas
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
Radu Badita
Galati, Romania
Phone : 004-0745-36.10.17
Email : [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to