2008/2/28, Antonio Petrelli <[EMAIL PROTECTED]>: > 2008/2/28, Pauli Savolainen <[EMAIL PROTECTED]>: > > > In the action I want to choose a correct body value based on some > > application specific rules. For example if I call: /user/1, the User > > action's show method is executed and the body attribute's value would turn > > into /user/show.jsp. This would prevent me from writing definitions for > each > > possible case. > > > You could use a ViewPreparer: > http://tiles.apache.org/tutorial/advanced/preparer.html > You can use the AttributeContext object passed as a parameter in the > "execute" method and override the "body" attribute. > To know the calling URL, look at the TilesRequestContext: > > http://tiles.apache.org/2.0/framework/apidocs/org/apache/tiles/context/TilesRequestContext.html > The "getRequest" method returns the original HttpServletRequest. > > HTH > > Antonio >
Hi, Thank you very much. I got it working with a little tweaking. I inspect the url in the view preparer and include a body content according to it. Works nice. Pauli
