📄 package-summary.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc on Thu Mar 09 15:31:22 GMT 2006 -->
<TITLE>
Apache Struts API Documentation: Package org.apache.struts.tiles
</TITLE>
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
</HEAD>
<BODY BGCOLOR="white">
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../org/apache/struts/taglib/tiles/util/package-summary.html"><B>PREV PACKAGE</B></A>
<A HREF="../../../../org/apache/struts/tiles/actions/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="package-summary.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
<H2>
Package org.apache.struts.tiles
</H2>
<div class="mainContent">
The Tiles taglib and framework allows building web pages by assembling reusable
pieces of pages, called Tiles.
<P>
<B>See: </B>
<BR>
<A HREF="#package_description"><B>Description</B></A>
<P>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Interface Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="AttributeDefinition.html"><I>AttributeDefinition</I></A></B></TD>
<TD>Attribute definition used in a component definition.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="ComponentDefinitionsFactory.html"><I>ComponentDefinitionsFactory</I></A></B></TD>
<TD><B>Deprecated.</B> <I>Use DefinitionsFactory instead.</I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="Controller.html"><I>Controller</I></A></B></TD>
<TD>A controller is a piece of code called before rendering a jsp page.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="DefinitionsFactory.html"><I>DefinitionsFactory</I></A></B></TD>
<TD>Tiles Definition factory.</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Class Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="ActionController.html">ActionController</A></B></TD>
<TD>Struts wrapper implementation of Controller.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="ComponentContext.html">ComponentContext</A></B></TD>
<TD>Component context.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="ComponentDefinition.html">ComponentDefinition</A></B></TD>
<TD>Definition of a template / component attributes.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="ControllerSupport.html">ControllerSupport</A></B></TD>
<TD>Basic implementation of Controller.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="DefinitionAttribute.html">DefinitionAttribute</A></B></TD>
<TD>Attribute representing a Component Definition.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="DefinitionNameAttribute.html">DefinitionNameAttribute</A></B></TD>
<TD>Component attribute.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="DefinitionsFactoryConfig.html">DefinitionsFactoryConfig</A></B></TD>
<TD>A TilesFactoryConfig object hold configuration attributes for a tile definition factory.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="DefinitionsUtil.html">DefinitionsUtil</A></B></TD>
<TD><B>Deprecated.</B> <I>Use <A HREF="../../../../org/apache/struts/tiles/TilesUtil.html#createDefinitionsFactory(javax.servlet.ServletContext, org.apache.struts.tiles.DefinitionsFactoryConfig)"><CODE>TilesUtil.createDefinitionsFactory(ServletContext, DefinitionsFactoryConfig)</CODE></A></I></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="DefinitionsUtil.ServletPropertiesMap.html">DefinitionsUtil.ServletPropertiesMap</A></B></TD>
<TD>Inner class.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="DirectStringAttribute.html">DirectStringAttribute</A></B></TD>
<TD>Component attribute.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="PathAttribute.html">PathAttribute</A></B></TD>
<TD>Component attribute.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="TilesPlugin.html">TilesPlugin</A></B></TD>
<TD>Tiles Plugin used to initialize Tiles.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="TilesRequestProcessor.html">TilesRequestProcessor</A></B></TD>
<TD><strong>RequestProcessor</strong> contains the processing logic that the Struts controller servlet performs as it receives each servlet request from the container.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="TilesUtil.html">TilesUtil</A></B></TD>
<TD>Class containing utility methods for Tiles.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="TilesUtilImpl.html">TilesUtilImpl</A></B></TD>
<TD>Default implementation of TilesUtil.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="TilesUtilStrutsImpl.html">TilesUtilStrutsImpl</A></B></TD>
<TD>TilesUtil implementation for Struts 1.1 with one single factory.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="TilesUtilStrutsModulesImpl.html">TilesUtilStrutsModulesImpl</A></B></TD>
<TD>Implementation of TilesUtil for Struts multi modules.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="UntypedAttribute.html">UntypedAttribute</A></B></TD>
<TD>Common implementation of attribute definition.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="UrlController.html">UrlController</A></B></TD>
<TD>Tiles controller including a local URL.</TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Exception Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="DefinitionsFactoryException.html">DefinitionsFactoryException</A></B></TD>
<TD>Exception thrown when an error occurs while the factory tries to create a new instance mapper.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="FactoryNotFoundException.html">FactoryNotFoundException</A></B></TD>
<TD>Exception thrown when definitions factory is not found.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="NoSuchDefinitionException.html">NoSuchDefinitionException</A></B></TD>
<TD>Exception thrown when a definition is not found.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="TilesException.html">TilesException</A></B></TD>
<TD>Root class for all Tiles-exceptions.</TD>
</TR>
</TABLE>
<P>
<A NAME="package_description"><!-- --></A><H2>
Package org.apache.struts.tiles Description
</H2>
<P>
<div class="mainContent">
The Tiles taglib and framework allows building web pages by assembling reusable
pieces of pages, called Tiles. A Tiles is usually a simple JSP page.
<img src="doc-files/tilesUML.gif" alt="TagLib Tiles UML">
<div class="section">
<h2>Introduction</h2>
<p>The Tiles framework allows building pages by assembling reusable Tiles.
As an example, the page in the next figure can be build by assembling a
header, a footer, a menu and a body.</p>
<p><img src="doc-files/image001.gif" height="169" width="145" alt="doc-files/image001"></p>
<p>Each Tiles (header, menu, body, ...) is a JSP page and can itself be build
by assembling other Tiles.</p>
<p>Using Tiles can be compared as using Java methods: You need to define the Tiles (the method body), and then you can "call" this body anywhere you want, passing it some parameters. In Tiles, parameters are called "attributes" in order to avoid confusion with the request parameters.</p>
<p>The Tiles body can be a simple JSP page, a Struts action or any URI pointing
to a resource inside the current web site.</p>
<p>Inserting the body, or calling it, is done with the tag <tiles:insert
...> anywhere in a JSP page. Insertion can also be done by specifying
a <em>definition name </em>as the path of a Struts forward or as input,
forward or include attributes of a Struts action.</p>
<p>Tiles bodies are used to create layouts, reusable parts, ... Tiles insertions
are used to insert Tiles. The same Tiles can be reused several times in
the same site, or even in the same page.</p>
<p>Insertion of a Tiles body can be associated to a logical name in what Tiles calls a "definition". A definition contains a logical name, a page used as body and some attribute values. The definition declaration doesn't insert the associated Tiles body. It just associates it with the name. A definition name can be used anywhere insertion of a Tiles body can occur. The associated Tiles body is then inserted with associated attributes.</p>
<p>The definition declarations can be done in JSP pages or in one or more
centralized files. A definition can extend another one, overload some attributes,
add new attributes ... This allows the declaration of a "master" definition
declaring the common layout, header, menu and footer. All other definitions
extend this master layout thereby making it possible to change the entire
site look & feel simply by changing the master definition. </p>
</div>
<div class="section">
<h2>Simple Examples</h2>
<div class="subsection1">
<h3>Insert a JSP page</h3>
<pre><tiles:insert <strong>page</strong>="/layouts/commonLayout.jsp" flush="true" />
</pre>
<p>This example inserts the specified page in place of the tag. The page attribute is any valid URL pointing to a resource inside the current site.</p>
</div>
<div class="subsection1">
<a name="doc.InsertPageWithAttributes"></a>
<h3>Insert a Tiles passing some attributes</h3>
<pre>
<tiles:insert page="/layouts/classicLayout.jsp" flush=&quot;true">
<tiles:put name="title" value="Page Title" />
<tiles:put name="header" value="/common/header.jsp" />
<tiles:put name="footer" value="/common/footer.jsp" />
<tiles:put name="menu" value="/common/menu.jsp" />
<tiles:put name="body" value="/tiles/mainBody.jsp" />
</tiles:insert>
</pre>
<p>This example inserts the specified page, passing it the attributes. Attributes
are stored in a Tiles context which is passed to the inserted pag and
can then be accesssed by their names.</p>
</div>
<div class="subsection1">
<h3>Retrieve an attribute value as String</h3>
<pre>
<tiles:getAsString name="title" />
</pre>
<p>This example retrieves the value of the attribute "title" and prints it as a String in the current output stream. The method toString() is applied on the attribute value, allowing to pass any kind of object as value.</p>
</div>
<div class="subsection1">
<h3>Insert Tiles referenced by an attribute</h3>
<pre>
<tiles:insert attribute='menu' />
</pre>
<p>This inserts the Tiles referenced by the attribute "menu" value. The
specified attribute value is first retrieved from current Tiles's context,
and then the value is used as a page target to insert.</p>
</div>
<div class="subsection1">
<h3>Classic Layout </h3>
<p>This example is a layout assembling a page in the classic header-footer-menu-body
fashion.</p>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -