Use tiles (I don't know how to use it myself. Please give me some advice)

Source: Internet
Author: User











*******

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"/>

<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"/>  

1.Create oneLayout. jspLayout page

******

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.