Putting It All Together


Now take a moment to walk through the entire flow of a page request using Tiles. Imagine that you request /index.do . Struts looks up the action , and finds that it should forward your request to the stocktrack.index layout. Tiles looks up that name and finds that it's an extension of the stocktrack.default layout. That layout uses the stocktrackDefault.jsp template file. So, Tiles combines the attributes from the two definitions and hands control over to the template file, which populates the contents from the various source files.

There are several advantages to using Tiles this way. For one thing, you can change the entire look of the site by adding a new template file and pointing the stocktrack.default layout at this new file.

Another advantage is that the content pages don't need to know anything about their surroundings. That means you can reuse the same content in several different layouts.

Also, using Tiles in this way totally removes any knowledge of the JSP filenames from the Struts configuration file. Everywhere in the application can refer to the logical names specified in the definitions file, and only the definitions file needs to actually know where the JSP files reside.



Struts Kick Start
Struts Kick Start
ISBN: 0672324725
EAN: 2147483647
Year: 2002
Pages: 177

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net