I think I've done this differently on every project and every way has turned out wrong. The way I do it now is objects in the environment. The great thing about this way is you can set defaults for the entire site, override them depending on development/production and override it at any point in the page render cycle. For example the defaults are set this way in AppModule.
@Contribute(EnvironmentSetup.class) public static void provideEnvironmentSetup(MappedConfiguration<Class, Object> configuration) { configuration.add(FrameworkEnvironment.class, new FrameworkValues(null).withName("tb")); configuration.add(ButtonEnvironment.class, new ButtonValues(null)); configuration.add(FormEnvironment.class, new FormValues(null)); configuration.add(NavEnvironment.class, new NavValues(null)); configuration.add(TableEnvironment.class, new TableValues(null)); } To override them @Contribute(EnvironmentSetup.class) public static void provideEnvironmentSetup(MappedConfiguration<Class, Object> configuration) { configuration.override(TableEnvironment.class, new TableValues(null).withType("table")); configuration.override(FormEnvironment.class, new FormValues(null).withType("form-horizontal")); } You'll need to set then in a markup filter public void contributeMarkupRenderer(OrderedConfiguration<MarkupRendererFilter> configuration, final Logger logger, final EnvironmentSetup environmentSetup, final Environment environment, final JavaScriptSupport javaScriptSupport, final ExcludeVisitor excludeVistior, @InjectService(BootstrapVisitor.id) final FrameworkVisitor frameworkVisitor, @InjectService("FrameworkProvider") final FrameworkProvider frameworkProvider) { MarkupRendererFilter bootstrapFilter = new MarkupRendererFilter() { public void renderMarkup(MarkupWriter writer, MarkupRenderer renderer) { environmentSetup.push(); // push all the defaults renderer.renderMarkup(writer); environmentSetup.pop(); // pop them after the render Don't forget public void contributePartialMarkupRenderer(OrderedConfiguration<PartialMarkupRendererFilter> configuration, Here is the service to push/pop them @SuppressWarnings("rawtypes") public class EnvironmentSetupImpl implements EnvironmentSetup { private final Map<Class,Object> setup; private final Environment environment; public EnvironmentSetupImpl(Map<Class,Object> setup, Logger logger, Environment environment) { this.setup = setup; this.environment = environment; } @SuppressWarnings("unchecked") public void push() { for ( Entry<Class, Object> entry : setup.entrySet() ) { environment.push(entry.getKey(), entry.getValue()); } } @SuppressWarnings("unchecked") public void pop() { for ( Entry<Class, Object> entry : setup.entrySet() ) { environment.pop(entry.getKey()); } } } Now you can access them in pages/components/services. Plus by pushing new ones you can override them at any point in the render cycle. I make the constructor take the current one so you can chain them like this environment.push(TableEnvironment.class, new TableValues(environment.peekRequired(TableEnvironment.class)).withType("table-bordered")); public class TableValues implements TableEnvironment { private String type; private boolean isInstrumented; private String sortElement = "i"; private String[] sortElementAttributes = {"class","icon-random"}; private String prefix = "table"; public TableValues(TableEnvironment values) { if ( values != null ) { type = values.getType(null); sortElement = values.getSortElement(); sortElementAttributes = values.getSortElementAttributes(); } } Finally I created an EnvironmentBinding so you can do this ${env:InterfaceName.property} https://github.com/trsvax/tapestry-bootstrap/blob/master/src/main/java/com/trsvax/bootstrap/services/EnvironmentBindingFactory.java While this might seem like a lot of code it's all pretty straight forward and can be implemented as a module so you can just drop it into any project. -- View this message in context: http://tapestry.1045711.n5.nabble.com/Where-to-store-site-settings-tp4849942p5607227.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org