Layouts


Tiles framework use a term “Layout” for a template. Layout serves the same purpose as template. The plus points of layouts is reusability of templates, we can define common layouts and reuse them across many different projects, even we can customize the existing layout

Pre-built Layouts from Tiles Framework
Here we describe some useful layouts available in the Tiles distribution.

One interesting point of Tiles is that it is possible to reuse existing layouts, define new layouts, and easily exchange a layout by a different one as long as they require the same set of attributes.For each layout, a short description, a description of requested attributes, an example of usage and the actual implementation is provided. You can easily customize any layout by starting from the provided implementation. All layouts examples can be found in the /layouts directory of the Tiles example jar file. They can be tested by pointing to the /examples directory of the Tiles example jar file.

1. Classic layout
It provides a classic"header, menu, body and footer" rendering. It defines the skeleton of a HTML page with <header> and <body>, and renders the header, menu, body and footer at appropriate places.
The classic layout requires the following attributes:
title - String used to set the title of the browser page.
header - URL or definition name used to render the header part.

2. Menu layout
The menu layout is used to render a simple menu with its links. A menu requires a list of "item" beans, each "item" contains data for one menu entry. It’s possible to develop other menu layouts taking the same attributes, and replace the menu layout by another one.
The menu layout requires the following attributes:
title - String used as menu title [optional]
items - List of items. Items are beans with the following properties: value, link,
tooltip; icon

3. Vertical box or vbox or vstack layout
The vbox layout is used to render a list of Tiles vertically. This layout is used when rendering a menu bar, or in multi - columns layout.
The vbox layout requires the following attributes:
list - List of names or URLs to insert.

4. Multi-columns layout
The multi-columns layout renders lists of Tiles in several columns stacked vertically. Lists of Tiles are passed as Tiles parameters, one list per column. A list can contain application URLs and definition names. This layout is used to build a portal main body made of several Tiles.
The multi-columns layout requires the following attributes:
numCols - Number of columns to render and passed as parameter.
list1 - First list of Tiles (URL or definition name)
list2 - Second list of Tiles (URL or definition name) [optional]
list3 - Third list of Tiles (URL or definition name) [optional]
listn - N-th list of Tiles (URL or definition name), where n is replaced by column index
[optional].

5. Center layout
The classical layout consisting of “top, left, center, right, bottom”. Left and right parts are
optional and can be omitted.
The center layout requires the following attributes:
header - URL or definition name used to render the header part.
right - URL or definition name used to render the right part. [optional]
body - URL or definition name used to render the header part.
left - URL or definition name used to render the left part. [optional]
footer - URL or definition name used to render the footer part.

6. Tabs layout
The tabs layout is used to render a list of Tiles in a tab fashion. The tabs layout has a body area used to render the currently selected Tile, and an indexes area used to render the available tabs or Tiles. This layout requires as argument a list of Tiles and names used in indexes.
The tabs layout requires the following attributes:
tabList - A list of Tiles URLs or definition names for the tabs. We use MenuItem to
carry data (Tiles name or URL, indexes name, icon, ...).
selectedIndex - Index of the default selected tab.
parameterName - Name of HTTP parameter carrying the selected Tile info in the HTTP
request.

 

Tiles tutorial
Introduction to Tiles
Web Page Layouts
JSP pages with embedded HTML
JSP pages with JSP include directive's (static) or JSP actions (dynamic)
JSP templates
Tiles
Layouts
Classic layout
Menu layout
Vertical box or vbox or vstack layout layout
Multi-columns layout
Center layout
Tabs layout
Installing Tiles
For Struts1.0
For Struts1.1
For Tiles stand alone
Configuring Tiles
Internationalizing Tiles
Create a Tile Layout
Use a Tile Layout
Create a Tile Definition
Use a Tile Definition

Use of this website constitutes acceptance of the AllAppLabs.com Terms and Conditions