in web.xml u can set all the constants u want as: <env-entry> <env-entry-name>nameVariavle</env-entry-name> <env-entry-value>valueVariable</env-entry-value> <env-entry-type>java.lang.String or whatelse</env-entry-type> </env-entry>
and use this for getting them public static String getEnvVar(String name) throws NamingException { String var=""; try { Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup( "java:comp/env" ); var = (String) envCtx.lookup( name ); } catch (NamingException e) { e.printStackTrace(); } return var; } regards!! ---------- Initial Header ----------- >From : "Seak, Teng-Fong" [EMAIL PROTECTED] To : "Tomcat Users List" tomcat-user@jakarta.apache.org Cc : Date : Tue, 27 Sep 2005 10:36:30 +0200 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]