dgraham 2002/12/22 15:10:29
Modified: doc/userGuide building_view.xml
Log:
Added text for section 3.4.3 Tiles.
Revision Changes Path
1.21 +55 -2 jakarta-struts/doc/userGuide/building_view.xml
Index: building_view.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/doc/userGuide/building_view.xml,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- building_view.xml 22 Dec 2002 19:41:19 -0000 1.20
+++ building_view.xml 22 Dec 2002 23:10:28 -0000 1.21
@@ -685,10 +685,63 @@
</section>
<section name="3.4.3 Page Composition With Tiles" href="Tiles">
-
<p>
- [:TODO:]
+ Tiles is a powerful templating library that allows you to construct
views by combining
+ various "tiles". Here's a quick setup guide:
</p>
+ <ol>
+ <li>Create a /layout/layout.jsp file that contains your app's common
look and feel:
+ <pre>
+ <html>
+ <body>
+ <tiles:insert attribute="body"/>
+ </body>
+ </html>
+ </pre>
+ </li>
+ <li>
+ Create your /index.jsp homepage file:
+ <pre>
+ <h1>This is my homepage!</h1>
+ </pre>
+ </li>
+ <li>Create a /WEB-INF/tiles-defs.xml file that looks like this:<br/>
+ <pre>
+ <tiles-definitions>
+ <definition name="layout"
path="/layout/layout.jsp">
+ <put name="body" value=""/>
+ </definition>
+ <definition name="homepage"
extends="layout">
+ <put name="body"
value="/index.jsp"/>
+ </definition>
+ <tiles-definitions>
+ </pre>
+ </li>
+ <li>
+ Setup the TilesPlugin in the struts-config.xml file:
+ <pre>
+ <plug-in
className="org.apache.struts.tiles.TilesPlugin">
+ <set-property
property="definitions-config" value="/WEB-INF/tiles-defs.xml"/>
+ </plug-in>
+ </pre>
+ </li>
+ <li>
+ Setup an action mapping in struts-config.xml to point to your
homepage tile:
+ <pre>
+ <action
+ path="/index"
+ type="org.apache.struts.actions.ForwardAction"
+ parameter="homepage"/>
+ </pre>
+ </li>
+ </ol>
+ <p>
+ The TilesPlugin configures a special RequestProcessor that determines
if the requested view is a
+ tile and processes it accordingly. Note that we made the homepage
tile extend our root layout
+ tile and changed the body attribute. Tiles inserts the file named in
the body attribute into the main
+ layout.
+ </p>
+ <p>See the the tiles-documentation webapp for in-depth examples.</p>
</section>
<section name="3.4.4 Image Rendering Components" href="image_rendering">
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>