You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Jeff Caddel <jc...@cox.net> on 2003/04/04 20:49:11 UTC
Advanced Tiles
After going thru Cedric's doc
(http://www.lifl.fr/~dumoulin/tiles/tilesAdvancedFeatures.pdf) on
Advanced Tiles Features I came up with something that's a slight
derivative of the example on page 15, right under where it says,
"Example of a controller inserted as an URL:". That example shows how
to associate a controller with a tile definition.
The point in doing that (as far as my wee little brain can tell) is to
try and make each tile as autonomous as possible. Right before each
tile loads, an action gets invoked by the framework. This gives you a
chance to execute business logic and prepare the request for the tile
that's about to load.
My issue is that I need a set of related actions to execute in an order
that I can control before any of the tiles start to render.
An example is a split screen where there is a tree of users displayed on
the left, and a single user displayed on the right. This screen has
/tree.do which preps the request for the tree, and /user.do which
handles all the user updates. For the tree to display correctly I need
/user.do to execute first (even though the tile it's associated with
renders second), so that /tree.do has the updated information when it
gets invoked. Here are the relevant snippets I came up with to get
this behavior:
At the top of layout.jsp: <tiles:insert definition="user.controllers"/>
tiles.xml:
<definition name="user.controllers"
path="/WEB-INF/jsp/common/controller.jsp">
<putList name="controllers">
<add value="/admin/user.do"/>
<add value="/admin/tree.do"/>
</putList>
</definition>
controller.jsp:
<tiles:importAttribute/>
<logic:iterate id="controller" name="controllers" type="java.lang.String">
<tiles:insert page="<%=controller%>" flush="false"/>
</logic:iterate>
This combination lets me execute an arbitrary set of actions in whatever
order I want by simply editing tiles.xml. Is this a clever thing to be
doing? A phenomenally bad idea? Is there (as there usually is) a
simpler/different way to get this behavior? Any and all
thoughts/comments/suggestions are welcome!
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org