Hi, Just enter your variables into a text file called abc.properties with name/value pairs, e.g
var1=val1 var2=val2 Although these will not automatically appear in application scope. You will need to write a tiny Servlet that you configure in web.xml, pass the filename as a servlet parameter, and set the servlet to load-on-startup=1. In your servlet, retrieve the filename and load the properties into a HashMap. Finally add it to the servlet context. Your application can now use the map from application scope, and better still, you can use it in JSTL syntax with $applicationScope.myprops['var1'] There are other ways but this is my recommended way. Allistair. > -----Original Message----- > From: Seak, Teng-Fong [mailto:[EMAIL PROTECTED] > Sent: 27 September 2005 09:37 > 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] > > <FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> ------------------------------------------------------- QAS Ltd. Registered in England: No 2582055 Registered in Australia: No 082 851 474 ------------------------------------------------------- </FONT> <FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLACK> Disclaimer: The information contained within this e-mail is confidential and may be privileged. This email is intended solely for the named recipient only; if you are not authorised you must not disclose, copy, distribute, or retain this message or any part of it. If you have received this message in error please contact the sender at once so that we may take the appropriate action and avoid troubling you further. Any views expressed in this message are those of the individual sender. QAS Limited has the right lawfully to record, monitor and inspect messages between its employees and any third party. Your messages shall be subject to such lawful supervision as QAS Limited deems to be necessary in order to protect its information, its interests and its reputation. Whilst all efforts are made to safeguard Inbound and Outbound emails, QAS Limited cannot guarantee that attachments are virus free or compatible with your systems and does not accept any liability in respect of viruses or computer problems experienced. </FONT>