That's another advantage of configuration in Java code ... you can put more complex decisions about these things in code, such as looking at the hostname to decide symbol defaults.
On Tue, Apr 24, 2012 at 9:04 AM, Rural Hunter <ruralhun...@gmail.com> wrote: > Thanks for the info Howard. Actually my requirement is like this: my > application generates reporting files in doc/pdf format. I need to set a > path where to store the generated reporting files. It maybe different when > the app is deployed on different servers. So I think the execution mode way > maybe not suitable for me. > > 于 2012/4/24 23:46, Howard Lewis Ship 写道: > >> I prefer to narrow things down to one system property: the Tapestry >> execution mode: >> >> >> http://tapestry.apache.org/configuration.html#Configuration-SettingExecutionModes >> >> This determines which Tapestry IoC modules(s) will be loaded. >> >> The modules make contributions to the @ApplicationDefaults and >> @FactoryDefaults SymbolProvider services. >> >> I typically have a "dev" and "production" and maybe "test" execution mode. >> >> In this way, most of the configuration is inside code, and because the >> execution mode is determined by a JVM system property, its easy to >> control which configuration is used when the application starts up, >> whether inside your IDE or on a continuous integration server. >> >> On Tue, Apr 24, 2012 at 8:34 AM, Rural Hunter<ruralhun...@gmail.com> >> wrote: >>> >>> ok, thanks a lot. I don't care if it has to be in my own properties file >>> or >>> not. I just want it easy to edit/chage. Now I work this way with your >>> hint: >>> 1. define the parameter as context-param in web.xml, eg. myParam >>> 2. inject it in my page class: >>> @Inject >>> @Value("${myParam}") >>> String myParam; >>> >>> Then I can use myParam in the page/service class very conveniently. pls >>> let >>> me know if there is any problem with this way. thanks. >>> >>> 于 2012/4/24 23:07, Lance Java 写道: >>> >>>> There is no silver bullet solution for this and it's a matter of taste. >>>> >>>> Tapestry has a number of built in SymbolProviders. You can specify a >>>> combination of system properties, init-params to the tapestry filter, >>>> factory defaults and application defaults >>>> >>>> http://tapestry.apache.org/symbols.html >>>> >>>> If you would like to configure your symbols in a properties file, there >>>> is >>>> a HowTo page here: >>>> >>>> >>>> http://wiki.apache.org/tapestry/Tapestry5HowToReadSymbolsFromPropertiesFile >>>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org >>> For additional commands, e-mail: users-h...@tapestry.apache.org >>> >> >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org