Howdy,

>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.

Just to clarify, let's call the person deploying your application the
server administrator (this person has access to server.xml / the tomcat
admin/manager webapps), and the people using your application the users.

>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.

No.  Webapps don't supply persistence.  You have to do it yourself, e.g.
using a database or configuring a file resource.

>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?

See:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-resources-howto.htm
l

This is probably the way you want to go.  The servlet administrator will
define the appropriate resources in server.xml.  You just use the
<env-entry> in your web.xml.  That way you distribute the same webapp
war to everyone.

What this JNDI entry point to is up to you: provide instructions to the
server administrator on whether the app will want a file (I suggest this
to start with) or something else (e.g. a DB into which the app can
write).

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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

Reply via email to