Take a look the controllerClass attribute of the definition element in the tiles config. It allows you to specify a controller class of type package org.apache.struts.tiles.Controller. This class is executed before the tile it is associated with is rendered and can be used to dynamically alter the component context.
I personally would prefer something a little more declarative, something similar to Cocoon's Selectors. So you could do something like the following <select type="someType"> <when test="foo"> <put name="body" value="/foo.jsp"/> </when> <otherwise> <put name="bar" value="/bar.jsp"/> </otherwise> </selector> Dan ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, December 19, 2002 5:52 PM Subject: [Tiles] definitionsFactory problem I'm not sure if this is a user problem or a dev problem or something that should eventually be submitted as a bug. Let me know if it should really be posted to the dev list. Here's what I'm trying to do: I want to be able to parameterize Tiles definitions with values set in an ActionForward. This allows us to customize a Tiles definition with specific properties for an action without extending a Tiles definition. Eventually we could even use it to customize the definition with runtime properties if we so desired. Consider the following template def. <definition name="main.template" path="/template.jsp"> <put name="content" value="/defaultpage.jsp"/> <put name="menu" value="/menu.jsp"/> <put name="sidebar" value="/sidebar.jsp"/> </definition> To customize this definition to display a customer page we have to do this: <definition name="cust.td" extends="main.template"> <put name="content" value="/customer.jsp"/> </definition> This is fine, except when you have a large application with over 100 screens or so. Then it would be nice if developers could have just one Tiles definition as outlined in the main.template definition above and write action forwards like this: <forward name="success" path="main.template" class="..."> <set-property property="content" value="/customer.jsp"/> </forward> I've gotten this to work by extending and hacking up TilesRequestProcessor. But it would be much easier if TilesRequestProcessor was written a little differently. I came up with two major drawbacks with TilesRequestProcessor. They are: 1) definitionsFactory is private. To extend TilesRequestProcessor, I have to override all (both) methods that use definitionsFactory and create my own instance of it. Wouldn't have to do that if the factory was protected. 2) processTilesDefinition() does not have access to the ForwardConfig to get properties off of it. So, before I post this to the dev list or create an enhancement request, I thought I'd ask here: 1. Is there something I missed in the design for making definitionsFactory private? Is there a good reason for this that I missed or was it just an oversight to make it private when TilesRequestProcessor was created? 2. Is there a reason the ForwardConfig is not passed into processDefinitionsFactory? If the interface was changed to pass this object in, one could override it to take advantage of custom ActionForward properties. 3. Is there some reason why I shouldn't be doing what I'm trying to do or is there a better approach? Thanks, Greg -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>