22-11-2012, 04:35 PM
Master the Tiles Framework
Master the Tiles Framework.pdf (Size: 261.54 KB / Downloads: 318)
What is this tutorial about?
This tutorial describes how to use the Tiles framework to create reusable
presentation components. (At its creation, the Tiles framework was originally called
Components. The name was changed because "components" means too many
different things, but the spirit of the original name remains.) Beyond site layouts,
however, you can do much more with tiles. You can, for example, compartmentalize
your presentation tier to better reuse layouts, HTML, and other visual components.
This tutorial strives to impart the basics of using the Tiles framework, then takes your
knowledge up a notch. By the time you finish, you will be able to use the more
advanced Tiles features to create reusable components.
Note: Throughout this tutorial, the terms tile and page are used interchangeably
because any Web resource can be a tile. A tile layout represents a special type of
tile you can use to place other tiles within it. A tile layout can be used as a tile in
another tile layout.
Who should take this tutorial?
If you find yourself writing the same three lines of JSP code on every page, or you
want to define complex template layouts easily, then you will benefit from this
tutorial.
This tutorial assumes you have a solid understanding of Java programming, MVC
(Model-View-Controller), Model 2, and JSP technology. While a good Struts
background lets you get the most out of this tutorial, if you're adept at JSP
programming, you should be able to follow most of what is going on.
The Tiles framework and architecture
Tiles framework
The Tiles framework turns the jsp:includes concept inside out -- thus letting you
more feasibly create reusable pages. With the Tiles framework, developers can build
pages by assembling reusable tiles. You should think of tiles as visual components.
A tile layout is a special JSP page that allows tiles to be placed. Tile layouts dictate
where the tiles will be laid out on the page. In many respects the tile layout
resembles a template layout. In fact, if you have used Struts templates before, then
you will note that the Tile frameworks is backwards compatible with the template
custom tag library.
Clarification of terms
The terms presented in this tutorial may seem overwhelming at first, so before we
discuss the Tiles framework in more detail, let's define some important terms.