*******
2.CreateTiles-defs.xmlFile and configure it accordingly..
*********
<? XML version = "1.0" encoding = "UTF-8"?>
<! Doctype tiles-Definitions public "-// Apache Software Foundation // DTD tiles configuration 1.1 // en" "http://jakarta.apache.org/struts/dtds/tiles-config_1_1.dtd">
<Tiles-Definitions>
<Definition name = "Member-definition" Path = "/JSP/layout. jsp">
<Put name = "TOP" value = "/MTop. Do"/>
<Put name = "Left" value = "/mleft. Do"/>
<Put name = "Main" value = "/defaultmmain. Do"/>
</Definition>
</Tiles-Definitions>
*********
This is equivalent to defining a member. jsp.
3.InWeb. xmlAndStruts-config.xmlAndWeb. xmlConfigure.
In the struts-config.xml, configure as follows:
***********
<Plug-in classname = "org. Apache. Struts. Tiles. tilesplugin">
<Set-Property = "definitions-config" value = "/WEB-INF/tiles-defs.xml"/>
<Set-Property = "definitions-parser-validate" value = "true"/>
</Plug-in>
***********
Configure the following in Web. xml:
************
<Init-param>
<Param-Name> definitions-config </param-Name>
<Param-value>/WEB-INF/tiles-defs.xml </param-value>
</Init-param>
************
4.CallTilesComponents
The tiles component is called through struts action, and the following action configuration is made in the struts-config.xml:
*************
<Action
Path = "/member"
Parameter = "Member-definition"
Type = "org. Apache. Struts. Actions. forwardaction"/>
**************
Then, you can access the tiles component equivalent to member. jsp by accessing/member. Do.
II --------------------- tilesAdvanced use--------------------------
Then, you can access the tiles component equivalent to member. jsp by accessing/member. Do.
*************
<Tiles-Definitions>
<Definition name = "Member-definition" Path = "/JSP/layout. jsp">
<Put name = "TOP"Value = "menu-definition" type = "Definition"/>
<Put name = "Left" value = "/mleft. Do"/>
<Put name = "Main" value = "/defaultmmain. Do"/>
</Definition>
************
Menu-definiton is configured separately as a sub-tiles component, so that simple tiles components can be combined into a complex tiles component.
2. Tiles component Extension
Tiles component extension. Many tiles components use the same template page layout. JSP is particularly useful. First, we define a common tiles component, such as base-definition. The value in the corresponding part of the component is set to null.
*************
<Definition name = "base-definition" Path = "/JSP/layout. jsp">
<Put name = "TOP" value = "/MTop. Do"/>
<Put name = "Left" value = "/mleft. Do"/>
<Put name = "Main" value = ""/>
</Definition> *************
</Definition>
******************
<Put name = "Main" value = "/defaultmmain. Do"/>
</Definition>
************
Menu-definiton is configured separately as a sub-tiles component, so that simple tiles components can be combined into a complex tiles component.
2. Tiles component Extension
Tiles component extension. Many tiles components use the same template page layout. JSP is particularly useful. First, we define a common tiles component, such as base-definition. The value in the corresponding part of the component is set to null.
*************
<Definition name = "base-definition" Path = "/JSP/layout. jsp">
<Put name = "TOP" value = "/MTop. Do"/>
<Put name = "Left" value = "/mleft. Do"/>
<Put name = "Main" value = ""/>
</Definition> *************
</Definition>
1. TilesComponent nesting
Other tiles components can be integrated, and the value in name = "Main" can be set to its own unique,
For example:
**************
<Definition name = "Member-definition" extends = "base. Definition">
<Put name = "Main" value = "/defaultmmain. Do"/>
Other tiles components can be integrated, and the value in name = "Main" can be set to its own unique,
For example:
**************
<Definition name = "Member-definition" extends = "base. Definition">
<Put name = "Main" value = "/defaultmmain. Do"/>
1.Create oneLayout. jspLayout page ******
|
<TD Height = "113" colspan = "2" Scope = "col"><Tiles: insert attribute = "TOP"/>
<TD width = "21%" Height = "409" Scope = "row"><Tiles: insert attribute = "Left"/><TD width = "79%" Height = "409" Scope = "row"><Tiles: insert attribute = "Main"/>