tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antonio Petrelli" <antonio.petre...@gmail.com>
Subject Re: Struts 2 Tiles 2 Runtime composition
Date Thu, 28 Feb 2008 14:52:53 GMT
2008/2/28, Pauli Savolainen <savolainen.pauli@gmail.com>:
>  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

Mime
View raw message