I use a properties file stored in the WEB-INF directory. Modifying the web.xml is too error prone. Using another XML file is a lot harder than a properties file. Just use the servlet context getResourceAsStream(), and pass that to the properties.load() method.
George Sexton MH Software, Inc. http://www.mhsoftware.com/ Voice: 303 438 9585 > -----Original Message----- > From: Seak, Teng-Fong [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 27, 2005 2:37 AM > To: Tomcat Users List > Subject: Flexible way of defining application variables in > text format? > > My webapp needs some application string variables for > configuration. For the moment, I hard-code them as class static > properties and compiled. But I'd like to know if there's any > method to > define such variables in a text file, something like the > global.asa in > ASP where we could simply write something like this withing the > application_onstart subroutine: > application("myvar") = "my value" > > I like them to be withing text file because if even > there's a need > to change config, I'd like to just launch a text editor, edit it and > start again! I don't want to install Eclipse or other IDE in > deployment > server just in case we need to change some parameter and have > to compile > everything. This is very inconvenient, non professional and stupid. > And the client would probably not appreciate this. > > OK, I know I could write a wrapper function to parse that > text file > and assign the correct values, but is there a simpler way? Is the > answer lying in the "web.xml" file? But its syntax seems quite > complicated that I've no idea what to begin. > > TIA > > --------------------------------------------------------------------- > 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]