The way I'd do this is to use Properties objects, and a few (perhaps even one?) files under WEB-INF/props On startup, on the setup page, you'd ask the user to supply the filepath to use. Then you'd write that info to WEB-INF/props/application.properties.
On subsequent restarts, your app looks to this file to "remember" where its stuff is, and can load the values into an appropriate area (like ServletContext) > -----Original Message----- > From: Christian Hvid [mailto:[EMAIL PROTECTED] > Sent: Friday, June 27, 2003 1:34 PM > To: [EMAIL PROTECTED] > Subject: "Persistent attributes" > > > Hello list. > > I have tried posting this question to comp.lang.java but I didn't get > the answer that I needed: > > I am writing a web application that stores its data in an XML-file. I > am deploying it via Apache Tomcat. I would like to make it easy to > deploy. For it to work the user deploying my application has > to set the > file name of the data storage. > > I can think of two approaches: > > 1. The application provides the user interface: My application has a > setup page and if it is the first time it is run it will ask the user > the file name of the data storage. > > To implement this I need to make a string persistent. Does Apache > Tomcat provide a way to make data persistent accross stop/starts? I > have tried setAttribute in ServletContext but the attributes > disappear > when the application is reloaded. > > 2. The servlet container provides the user interface: I find > the Tomcat > web interface slightly clumsy but there is something called > environment > entries in the administration tool. How do I read these environment > entries in my application? > > Alternatively: Is there a way to set the init parameters > (that are read > via ServletConfig) from within Apache Tomcat's web interface? > > Any help appreciated. > > -- Christian > > PS: If you are interested - I am making a Wiki and it is available > including source here: > http://vredungmand.dk/programming/orange/index.html --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
