cedric 01/09/10 06:13:05
Modified: contrib/tiles/web/doc/WEB-INF tilesDefinitions.xml
struts-config.xml
contrib/tiles/web/doc/test index.jsp
contrib/tiles/web/doc/doc/portal revisions.jsp download.jsp
contrib/tiles/web/doc/doc installation.html
contrib/tiles/web/doc/tutorial/invoice index.jsp
editInvoice2.jsp editInvoice.jsp editAddress2.jsp
editAddress.jsp
Added: contrib/tiles/web/doc/test testStrutsAction.jsp failpage.jsp
Log:
Update examples.
Add Tiles - Struts Action integration test
Change "invoice" example : do not use 'extended.tld' anymore.
Revision Changes Path
1.2 +12 -0
jakarta-struts/contrib/tiles/web/doc/WEB-INF/tilesDefinitions.xml
Index: tilesDefinitions.xml
===================================================================
RCS file:
/home/cvs/jakarta-struts/contrib/tiles/web/doc/WEB-INF/tilesDefinitions.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- tilesDefinitions.xml 2001/08/01 14:36:47 1.1
+++ tilesDefinitions.xml 2001/09/10 13:13:04 1.2
@@ -138,5 +138,17 @@
<put name="body" value="body.jsp" direct="false" />
</definition>
+ <!-- Test Struts Action and Tiles integration -->
+<definition name="test.struts.action" path="/test/layout.jsp" >
+ <put name="title" value="Test Struts Action and Tiles integration : default
title" direct="true" />
+ <put name="header" value="header.jsp"/>
+ <put name="body" value="body.jsp" direct="false" />
+</definition>
+
+ <!-- Test Struts Action and Tiles integration -->
+<definition name="test.struts.action.fail" path="/test/failpage.jsp" >
+ <put name="title" value="Test fail" direct="true" />
+</definition>
+
</component-definitions>
1.2 +14 -0 jakarta-struts/contrib/tiles/web/doc/WEB-INF/struts-config.xml
Index: struts-config.xml
===================================================================
RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/WEB-INF/struts-config.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- struts-config.xml 2001/08/01 14:36:47 1.1
+++ struts-config.xml 2001/09/10 13:13:04 1.2
@@ -64,6 +64,20 @@
<forward name="success" path="/tutorial/invoice/index.jsp"/>
</action>
+ <!-- Test Struts action and Tiles integration -->
+ <action path="/test/testAction"
+
type="org.apache.struts.example.tiles.test.TestActionTileAction">
+ <forward name="success" path="test.struts.action"/>
+ <forward name="failure" path="test.struts.action.fail"/>
+ </action>
+
+ <!-- Test Struts action and Tiles integration -->
+ <action path="/test/testActionForwardJsp"
+
type="org.apache.struts.example.tiles.test.TestActionTileAction">
+ <forward name="success" path="/test/layout.jsp"/>
+ <forward name="failure" path="test.struts.action.fail"/>
+ </action>
+
<!-- test, to be removed -->
<action path="/tutorial/testAction"
type="org.apache.struts.example.tiles.lang.SelectLocaleAction">
1.2 +1 -0 jakarta-struts/contrib/tiles/web/doc/test/index.jsp
Index: index.jsp
===================================================================
RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/test/index.jsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- index.jsp 2001/08/01 14:36:46 1.1
+++ index.jsp 2001/09/10 13:13:04 1.2
@@ -13,6 +13,7 @@
<LI><A href="testList.jsp">test lists</A>
<LI><A href="testDefinitions.jsp">test definitions</A>
<LI><A href="testRole.jsp">test role (With Tomcat, use 'tomcat' as userid and
password)</A>
+ <LI><A href="testStrutsAction.jsp">test struts action integration and
behavior</A>
<LI><A href="testAll.jsp">All in
one</A> (main code + test
results) </LI></UL>
1.1 jakarta-struts/contrib/tiles/web/doc/test/testStrutsAction.jsp
Index: testStrutsAction.jsp
===================================================================
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
<%-- Test tiles and struts action integration (require factory)
--%>
<hr>
<strong>Test definition set in action, and action forward to another
definition</strong>
<br>
<tiles:insert page="/test/testAction.do" >
<tiles:put name="title" value="Test definition set in action, and action
forward to another definition. Title is overloaded from insert" />
<%-- header and body values come from definition used in action's forward --%>
<%-- name of definition to use in action --%>
<tiles:put name="set-definition" value="test.layout.test1" />
</tiles:insert>
<hr>
<strong>Test overload parameter in action</strong>
<br>
<tiles:insert page="/test/testAction.do" >
<tiles:put name="title" value="Test overload parameter in action"
/>
<tiles:put name="header" value="header.jsp" />
<tiles:put name="body" value="body.jsp" />
<%-- name and value of attribute to set in action --%>
<tiles:put name="set-attribute" value="title" />
<tiles:put name="set-attribute-value" value="Test overload parameter in action :
Overloaded title" />
</tiles:insert>
<hr>
<strong>Test definition set in action, and action forward directly to jsp</strong>
<br>
<tiles:insert page="/test/testActionForwardJsp.do" >
<tiles:put name="title" value="Test definition set in action, and
action forward directly to jsp" />
<tiles:put name="header" value="header.jsp" />
<tiles:put name="body" value="body.jsp" />
</tiles:insert>
1.1 jakarta-struts/contrib/tiles/web/doc/test/failpage.jsp
Index: failpage.jsp
===================================================================
<strong>Error</strong>
<br>
<%=request.getAttribute( "actionError" )%>
1.2 +21 -1 jakarta-struts/contrib/tiles/web/doc/doc/portal/revisions.jsp
Index: revisions.jsp
===================================================================
RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/doc/portal/revisions.jsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- revisions.jsp 2001/08/01 14:36:45 1.1
+++ revisions.jsp 2001/09/10 13:13:04 1.2
@@ -2,11 +2,31 @@
<tr>
<th bgcolor="aqua"><FONT size=4>History</FONT></th></tr>
<TR>
+ <TD><FONT size=2><STRONG> 09 sept. 2001</STRONG> </FONT></TD></TR>
+ <TR>
+ <TD>
+ <UL>
+ <LI><FONT size=2> Modify
+ ComponentActionServlet. It now allows
+ to :</FONT>
+ <ul>
+ <LI><FONT size=2> use a Struts
+ action as the page
+ attribute of an <insert>
+ or <definition></FONT>
+ <LI><FONT size=2>modify tile attributes inside
+ action</FONT>
+ <LI><FONT size=2>associate an action with a tile,
+ and this for each tile.</FONT>
+ </ul>
+ <LI><FONT size=2>Update and modify the "invoice"
+ example. </FONT></LI></UL></TD></TR>
+ <TR>
<TD><FONT size=2><STRONG> 30 jul. 2001</STRONG> </FONT></TD></TR>
<TR>
<TD>
<UL>
- <LI><FONT size=2> Join Documentation
+ <LI><FONT size=2> Merge Documentation
and tutorial in one
war file.</FONT></LI></UL></TD></TR>
<TR>
1.2 +1 -1 jakarta-struts/contrib/tiles/web/doc/doc/portal/download.jsp
Index: download.jsp
===================================================================
RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/doc/portal/download.jsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- download.jsp 2001/08/01 14:36:45 1.1
+++ download.jsp 2001/09/10 13:13:04 1.2
@@ -15,7 +15,7 @@
You can also
download it, and additional resources, from</font> <font size="2">following
web sites :</font> </div>
<div align="center">
- <font size="2">Latest build : 2001 07 31 (with struts
2001
+ <font size="2">Latest build : 2001 09 09 (with struts
2001
07 15 - 1.1dev)</font> </div>
<div align="center">
<table border="2">
1.2 +113 -118 jakarta-struts/contrib/tiles/web/doc/doc/installation.html
Index: installation.html
===================================================================
RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/doc/installation.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- installation.html 2001/08/01 14:36:45 1.1
+++ installation.html 2001/09/10 13:13:05 1.2
@@ -1,170 +1,165 @@
-<TABLE>
- <TR>
- <TD><A name="Prerequisites"></A>
- <TABLE border="0" cellspacing="5" cellpadding="5" width="100%">
- <TR>
- <TD bgcolor="#023264"><FONT color="#ffffff"
face="arial,helvetica,sanserif" size="+1"><STRONG>Prerequisite Software</STRONG></FONT>
- </TD>
- </TR>
- <TR>
- <TD>
- <BLOCKQUOTE>
+ <TABLE>
+ <TR>
+ <TD><A name="Prerequisites"></A>
+ <TABLE border="0" cellspacing="5" cellpadding="5"
width="100%">
+ <TR>
+ <TD bgcolor="#023264"><FONT
color="#ffffff" face="arial,helvetica,sanserif" size="+1"><STRONG>Prerequisite
Software</STRONG></FONT>
+ </TD>
+ </TR>
+ <TR>
+ <TD>
+ <BLOCKQUOTE>
<P>Copyright : This page is largely inspired
- from the original<A
href="http://www.apache.com/struts/installation.html">Struts
+ from the original <A
href="http://www.apache.com/struts/installation.html">Struts
installation page</A>. For those familiar with Struts, there is
nothing realy new.</P>
<P>In order to install and use a binary distribution, you will need to acquire
and install several other software packages, as follows:<BR></P>
- <UL>
- <LI><STRONG>Java Development
Kit</STRONG>- You must download and install a version 1.1 (or later) Java
Development Kit implementation for your operating system platform.
You<EM>must</EM>have a Java2 version (JDK 1.2 or later) to build the Struts
source distribution, and several of the custom tags in the Struts library
require Java2 to execute. A good starting point for locating Java Development
Kit distributions is<A href="http://java.sun.com/j2se">http://java.sun.com/j2se</A>.
-
- <LI><STRONG>Struts</STRONG>-
You must download and install <A href="http://jakarta.apache.org/struts">Struts</A> ,
with release greater than 0.5.
- A compatible release of Struts is attached with examples.
-
- <li><strong>Jakarta Commons Packages</strong> - Tiles utilizes several
- packages from the <a href="http://jakarta.apache.org/commons/">Jakarta
- Commons Project</a>. If you are utilizing a binary distriubtion of
- Tiles, the corresponding JAR files are included in the <code>lib</code>
- directory. However, if you wish to build Struts from source, you will
+ <UL>
+ <LI><STRONG>Java
Development Kit</STRONG>- You must download and install a version 1.1 (or later)
Java Development Kit implementation for your operating system platform.
You<EM>must</EM>have a Java2 version (JDK 1.2 or later) to build the Struts
source distribution, and several of the custom tags in the Struts library
require Java2 to execute. A good starting point for locating Java Development
Kit distributions is<A href="http://java.sun.com/j2se"> http://java.sun.com/j2se</A>.
+
<LI><STRONG>Struts</STRONG>- You must download and install <A
href="http://jakarta.apache.org/struts">Struts</A> , with release greater than 1.0.
+ A compatible release of Struts is attached with examples.
+ <LI><STRONG>Jakarta
Commons Packages</STRONG> - Tiles utilizes several
+ packages from the <A href="http://jakarta.apache.org/commons/">Jakarta
+ Commons Project</A>. If you are utilizing a binary distriubtion of
+ Tiles, the corresponding JAR files are included in the
+ <CODE>lib</CODE>directory.
However, if you wish to build Tiles from source, you will
need to download and install the following packages:
- <ul>
- <li><em>Beanutils</em> (Version 1.0 or later)</li>
- <li><em>Collections</em> (Version 1.0 or later)</li>
- <li><em>Digester</em> (Version 1.0 or later)</li>
- </ul></li>
- <LI><STRONG>Servlet
Container</STRONG>- You must download and install a servlet container that is
compatible with the Servlet API Specification, version 2.2 or later, and the
JavaServer Pages (JSP) Specification, version 1.1 or later. One popular choice
is to download Apache's<A href="http://jakarta.apache.org/tomcat">Tomcat</A>(version
3.1 or later required,
+ <UL>
+
<LI><EM>Beanutils</EM> (Version 1.0 or later)
+
<LI><EM>Collections</EM> (Version 1.0 or later)
+
<LI><EM>Digester</EM> (Version 1.0 or later)</LI>
+ </UL>
+ <LI><STRONG>Servlet
Container</STRONG>- You must download and install a servlet container that is
compatible with the Servlet API Specification, version 2.2 or later, and the
JavaServer Pages (JSP) Specification, version 1.1 or later. One popular choice
is to download Apache's<A href="http://jakarta.apache.org/tomcat"> Tomcat
</A> (version 3.1 or later required,
version 3.2 or later recommended).
- <LI><STRONG>Servlet API
Classes</STRONG>- In order to compile Struts itself, or applications that use
Struts, you will need a
- <CODE>servlet.jar</CODE>file
containing the Servlet and JSP API classes. Most servlet containers include
this JAR file. Otherwise, you can get the Servlet API classes distribution
from<A href="http://jakarta.apache.org/builds/jakarta-servletapi">here</A>.
- <li><strong>XML Parser</strong> - Tiles requires the presence of an XML
+ <LI><STRONG>Servlet
API Classes</STRONG>- In order to compile Struts itself, or applications that
use Struts, you will need a
+ <CODE>servlet.jar</CODE>file
containing the Servlet and JSP API classes. Most servlet containers include
this JAR file. Otherwise, you can get the Servlet API classes distribution from<A
href="http://jakarta.apache.org/builds/jakarta-servletapi"> here</A>.
+ <LI><STRONG>XML
Parser</STRONG> - Tiles requires the presence of an XML
parser that is compatible with the Java API for XML Parsing (JAXP)
specification, 1.1 or later. You can download and install the JAXP
- <a href="http://java.sun.com/xml">reference implementation</a>,
+ <A href="http://java.sun.com/xml">reference implementation</A>,
which is required for building the Tiles source distribution. In
Tiles web applications, you may replace the reference
implementation classes with any other JAXP compliant parser, such as
- <a href="http://xml.apache.org/xerces-j">Xerces</a>. See detailed
+ <A href="http://xml.apache.org/xerces-j">Xerces</A>. See detailed
instructions related to the parser in the instructions for
- <a href="#Building">building</a> and <a href="#Installing">installing</a>
- Tiles, below.</li>
- <li><strong>Xalan XSLT Processor</strong> - If you are building Tiles from
+ <A href="#Building">building</A> and <A href="#Installing">installing</A>
+ Tiles, below.
+ <LI><STRONG>Xalan XSLT
Processor</STRONG> - If you are building Tiles from
the source distribution, you will need a version of Xalan to perform
XSLT transformations. If you are using the JAXP/1.1 XML parser, you
- should use the version of <code>xalan.jar</code> shipped with it.
+ should use the version of
+ <CODE>xalan.jar</CODE>shipped
with it.
Otherwise, download and install version 1.2 of Xalan from
- <a href="http://xml.apache.org/xalan">here</a>.</li>
- </UL></BLOCKQUOTE>
- </TD>
- </TR>
- </TABLE><A name="Building"></A>
- <TABLE border="0" cellspacing="5" cellpadding="5" width="100%">
- <TR>
- <TD bgcolor="#023264"><FONT color="#ffffff"
face="arial,helvetica,sanserif" size="+1"><STRONG>Building Tiles Library From
Source</STRONG></FONT>
- </TD>
- </TR>
- <TR>
- <TD>
- <BLOCKQUOTE>
+ <A href="http://xml.apache.org/xalan">here</A>.</LI>
+ </UL></BLOCKQUOTE>
+ </TD>
+ </TR>
+ </TABLE><A name="Building"></A>
+ <TABLE border="0" cellspacing="5" cellpadding="5"
width="100%">
+ <TR>
+ <TD bgcolor="#023264"><FONT
color="#ffffff" face="arial,helvetica,sanserif" size="+1"><STRONG>Building Tiles
Library From Source</STRONG></FONT>
+ </TD>
+ </TR>
+ <TR>
+ <TD>
+ <BLOCKQUOTE>
<P>You can build Tiles yourself by running ant on provided build.xml file. You need
first to set some properties in
build.properties</P></BLOCKQUOTE>
- </TD>
- </TR>
- </TABLE><A name="Installing"></A>
- <TABLE border="0" cellspacing="5" cellpadding="5" width="100%">
- <TR>
- <TD bgcolor="#023264"><FONT color="#ffffff"
face="arial,helvetica,sanserif" size="+1"><STRONG>Install A Binary
Distribution</STRONG></FONT>
- </TD>
- </TR>
- <TR>
- <TD>
- <BLOCKQUOTE>
+ </TD>
+ </TR>
+ </TABLE><A name="Installing"></A>
+ <TABLE border="0" cellspacing="5" cellpadding="5"
width="100%">
+ <TR>
+ <TD bgcolor="#023264"><FONT
color="#ffffff" face="arial,helvetica,sanserif" size="+1"><STRONG>Install A Binary
Distribution</STRONG></FONT>
+ </TD>
+ </TR>
+ <TR>
+ <TD>
+ <BLOCKQUOTE>
<P>First, download a binary
distribution. Then, make sure you have downloaded and
installed all of the<A href="#Prerequisites">prerequisite</A> software packages
described above.<BR></P>
<P>Unpack the binary distribution into a convenient directory. The
distribution consists of the following contents:<BR></P>
- <UL>
-
<LI><STRONG>lib/tiles.jar</STRONG>- This JAR file contains all of the Java
classes included in tiles. It should be copied into the
- <CODE>WEB-INF/lib</CODE>directory of
your web application.
-
<LI><STRONG>lib/tiles.tld</STRONG>- This is the "tag library descriptor" file
that describes the custom tags in the Tiles library. It should be copied into
the
- <CODE>WEB-INF</CODE>directory of your
web
+ <UL>
+
<LI><STRONG>lib/tiles.jar </STRONG>- This JAR file contains all of the Java
classes included in tiles. It should be copied into the
+ <CODE> WEB-INF/lib
</CODE>directory of your web application.
+ <LI><STRONG>
lib/tiles.tld </STRONG>- This is the "tag library descriptor" file that
describes the custom tags in the Tiles library. It should be copied into the
+ <CODE> WEB-INF
</CODE>directory of your web
application.
-
<LI><STRONG>lib/extension.tld</STRONG>- This is the "extension
+
<LI><STRONG>lib/extension.tld</STRONG>- This is the "extension
tag library descriptor" file that describes the extension tags
which are basically Struts tags, with additional useful
functionalities for tiles. It should be copied into the
- <CODE>WEB-INF</CODE>directory of your
+ <CODE>WEB-INF</CODE>directory
of your
web application.
-
<LI><STRONG>webapps/tiles-doc.war</STRONG>
- - This is a "web application archive" file containing
- all of the documentation and examples. You can install this web
application on any servlet container compatible with Servlet API 2.2 or later.
-
<LI><STRONG>webapps/tiles-tutorial.war</STRONG>
- - Examples from the tutorial. You can
install this web application on any servlet container compatible with the
Servlet 2.2 (or later) and JSP 1.1 (or later) specifications.
-
<LI><STRONG>webapps/tiles-template.war</STRONG>
+
<LI><STRONG>webapps/tiles-doc.war</STRONG> - This is a
+ "web application archive" file containing all
+ of the documentation and examples. You can install this
+ web application on any servlet container compatible with Servlet
API 2.2 or later. This archive also contains examples from the tutorial
(under tiles-doc/tutorial).
+
<LI><STRONG>webapps/tiles-channel.war</STRONG>
+ - Examples
using a custom definition factory.
+
<LI><STRONG>webapps/tiles-template.war</STRONG>
- Original
Struts Template example, revisited with Tiles and Instances. You
can install this web application on any servlet container
compatible with the Servlet 2.2 (or later) and JSP 1.1 (or
later) specifications.</LI>
- </UL></BLOCKQUOTE>
+ </UL></BLOCKQUOTE>
<P>To use Tiles in your own application, you will need to follow these
steps:<BR></P>
- <BLOCKQUOTE>
- <UL>
- <LI>Copy the file
- <CODE>lib/tiles.jar</CODE>from the
Tiles distribution into the
- <CODE>WEB-INF/lib</CODE>directory of
your web application.
- <LI>Copy
- <CODE>lib/tiles.tld and
+ <BLOCKQUOTE>
+ <UL>
+ <LI>Copy the file
+ <CODE>lib/tiles.jar
</CODE>from the Tiles distribution into the
+ <CODE>WEB-INF/lib
</CODE>directory of your web application.
+ <LI>Copy
+ <CODE>lib/tiles.tld and
lib/extensions.</CODE><FONT face="Courier New">tld</FONT>from the
Tiles distribution into the
- <CODE>WEB-INF</CODE>directory
of your web application.
- <LI>Modify the
- <CODE>WEB-INF/web.xml</CODE>file for
your web application to include a
- <CODE><servlet></CODE>element to
define the controller servlet, and a
-
<CODE><servlet-mapping></CODE>element to establish which request URIs
are mapped to this servlet. Use the
- <CODE>WEB-INF/web.xml</CODE>file from
the
+ <CODE>WEB-INF </CODE>directory
of your web application.
+ <LI>Modify the
+ <CODE>WEB-INF/web.xml
</CODE>file for your web application to include a
+ <CODE><servlet>
</CODE>element to define the controller servlet, and a
+ <CODE><servlet-mapping>
</CODE>element to establish which request URIs are mapped to this servlet.
Use the
+ <CODE>WEB-INF/web.xml
</CODE>file from the
Struts example application for a detailed example of the
required syntax.
- <LI>If you want to use
<EM>definitions configuration file</EM>,
+ <LI>If you want to use
<EM>definitions configuration file</EM>,
use the modified version of <EM>ActionServlet</EM>
, by adding following lines in the
- <CODE>WEB-INF/web.xml</CODE>file :
-
<CODE><BR><servlet><BR>
+ <CODE>WEB-INF/web.xml
</CODE>file :
+
<CODE><BR><servlet><BR>
<servlet-name>action</servlet-name><BR>
<servlet-class>org.apache.struts.tiles.ActionComponentsServlet</servlet-class<BR>
<init-param><BR>
<param-name>definitions-config</param-name><BR>
<param-value>/WEB-INF/tilesInstances.xml</param-value><BR>
</init-param><BR>...<BR> </CODE>
- <LI>If you use <EM>definitions
configuration file</EM>, but don't want to
+ <LI>If you use
<EM>definitions configuration file</EM>, but don't want to
use modified servlet, you must initialize definitions factory,
either
in your own servlet (see ActionComponentsServlet.java) or at
begining of page (see tags).
- <LI>Modify the
- <CODE>WEB-INF/web.xml</CODE>file of
your web
+ <LI>Modify the
+ <CODE>WEB-INF/web.xml
</CODE>file of your web
application to include the following tag library
declarations:<BR>
<taglib><BR>
<taglib-uri>/WEB-INF/tiles.tld</taglib-uri><BR>
<taglib-location>/WEB-INF/tiles.tld</taglib-location><BR>
</taglib>
- <LI>Create a file
-
<CODE>WEB-INF/struts-config.xml</CODE><FONT
- face="Courier New"> </FONT>that defines the action mappings
for your specific application. You can use the
- <CODE>struts-config.xml</CODE>file
from the portal example application for a detailed example of the required
syntax.
- <LI>At the top of each JSP
page that will
- use the Tiles custom tags, add line(s) declaring the
- Tiles custom tag libraries used on this particular page, like
- this:< PRE> <@ taglib uri="/WEB-INF/tiles.tld"
- prefix="tiles" %>
- <PRE></PRE>
- <LI>When compiling the Java
classes that comprise your application, be sure to include the
- <CODE>tiles.jar</CODE>file (copied
earlier)
+ <LI>Create a file
+
<CODE>WEB-INF/struts-config.xml </CODE><FONT face="Courier New"> </FONT>that defines
the action mappings for your specific application. You can use the
+ <CODE>struts-config.xml
</CODE>file from the portal example application for a detailed example of the required
syntax.
+ <LI>At the top of each
JSP page that
+ will use the Tiles custom tags, add line(s) declaring
+ the Tiles custom tag libraries used on this particular page,
+ like this
+
+ <PRE><@ taglib
uri="/WEB-INF/tiles.tld" prefix="tiles" %></PRE>
+ <LI>When compiling the
Java classes that comprise your application, be sure to include the
+ <CODE>tiles.jar </CODE>file
(copied earlier)
on the CLASSPATH that is submitted to the compiler.</LI>
- </UL></BLOCKQUOTE>
- </TD>
- </TR>
- </TABLE>
- </TD>
- </TR>
-</TABLE>
-</BODY>
-</TD>
-</TR>
-</TABLE>
+ </UL></BLOCKQUOTE>
+ </TD>
+ </TR>
+ </TABLE>
+ </TD>
+ </TR>
+ </TABLE></TD></TR></TABLE>
\ No newline at end of file
1.2 +2 -1 jakarta-struts/contrib/tiles/web/doc/tutorial/invoice/index.jsp
Index: index.jsp
===================================================================
RCS file: /home/cvs/jakarta-struts/contrib/tiles/web/doc/tutorial/invoice/index.jsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- index.jsp 2001/08/01 14:36:47 1.1
+++ index.jsp 2001/09/10 13:13:05 1.2
@@ -2,6 +2,7 @@
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="comp" %>
<comp:insert definition="mainLayout" flush="true">
- <comp:put name="body" value="/tutorial/invoice/editInvoice.jsp" />
+ <%-- <comp:put name="body" value="/tutorial/invoice/editInvoice.jsp" /> --%>
+ <comp:put name="body" value="/tutorial/invoice/editInvoice2.jsp" />
</comp:insert>
1.2 +7 -7
jakarta-struts/contrib/tiles/web/doc/tutorial/invoice/editInvoice2.jsp
Index: editInvoice2.jsp
===================================================================
RCS file:
/home/cvs/jakarta-struts/contrib/tiles/web/doc/tutorial/invoice/editInvoice2.jsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- editInvoice2.jsp 2001/08/01 14:36:47 1.1
+++ editInvoice2.jsp 2001/09/10 13:13:05 1.2
@@ -1,5 +1,5 @@
<%@ page language="java" %>
-<%@ taglib uri="/WEB-INF/tiles.tld" prefix="comp" %>
+<%@ taglib uri="/WEB-INF/tiles.tld" prefix="comp" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
@@ -43,9 +43,9 @@
<%-- Include an "address editor" component.
--%>
<%-- Pass the component name and component value as parameter --%>
<%-- Value comes from the form bean --%>
- <comp:insert page="/tutorial/invoice/editAddress2.jsp" >
- <comp:put name="property" value="shippingAddress" />
- <comp:put name="bean" beanName="invoiceform" />
+ <comp:insert page="/tutorial/invoice/editAddress.jsp" >
+ <comp:put name="compName" value="shippingAddress" />
+ <comp:put name="address" beanName="invoiceForm"
beanProperty="shippingAddress" />
</comp:insert>
</td>
</tr>
@@ -60,9 +60,9 @@
</tr>
<tr>
<td align="center" colspan="2">
- <comp:insert page="/tutorial/invoice/editAddress2.jsp" >
- <comp:put name="property" value="billAddress" />
- <comp:put name="bean" beanName="invoiceform" beanProperty="billAddress" />
+ <comp:insert page="/tutorial/invoice/editAddress.jsp" >
+ <comp:put name="compName" value="billAddress" />
+ <comp:put name="address" beanName="invoiceForm" beanProperty="billAddress" />
</comp:insert>
</td>
</tr>
1.2 +9 -9
jakarta-struts/contrib/tiles/web/doc/tutorial/invoice/editInvoice.jsp
Index: editInvoice.jsp
===================================================================
RCS file:
/home/cvs/jakarta-struts/contrib/tiles/web/doc/tutorial/invoice/editInvoice.jsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- editInvoice.jsp 2001/08/01 14:36:47 1.1
+++ editInvoice.jsp 2001/09/10 13:13:05 1.2
@@ -1,5 +1,5 @@
<%@ page language="java" %>
-<%@ taglib uri="/WEB-INF/tiles.tld" prefix="comp" %>
+<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
@@ -43,10 +43,10 @@
<%-- Include an "address editor" component.
--%>
<%-- Pass the component name and component value as parameter --%>
<%-- Value comes from the form bean --%>
- <comp:insert page="/tutorial/invoice/editAddress.jsp" >
- <comp:put name="compName" value="shippingAddress" />
- <comp:put name="address" beanName="invoiceForm"
beanProperty="shippingAddress" />
- </comp:insert>
+ <tiles:insert page="/tutorial/invoice/editAddress2.jsp" >
+ <tiles:put name="property" value="shippingAddress" />
+ <tiles:put name="bean" beanName="invoiceForm" />
+ </tiles:insert>
</td>
</tr>
@@ -60,10 +60,10 @@
</tr>
<tr>
<td align="center" colspan="2">
- <comp:insert page="/tutorial/invoice/editAddress.jsp" >
- <comp:put name="compName" value="billAddress" />
- <comp:put name="address" beanName="invoiceForm" beanProperty="billAddress" />
- </comp:insert>
+ <tiles:insert page="/tutorial/invoice/editAddress2.jsp" >
+ <tiles:put name="property" value="billAddress" />
+ <tiles:put name="bean" beanName="invoiceForm" />
+ </tiles:insert>
</td>
</tr>
1.2 +8 -11
jakarta-struts/contrib/tiles/web/doc/tutorial/invoice/editAddress2.jsp
Index: editAddress2.jsp
===================================================================
RCS file:
/home/cvs/jakarta-struts/contrib/tiles/web/doc/tutorial/invoice/editAddress2.jsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- editAddress2.jsp 2001/08/01 14:36:47 1.1
+++ editAddress2.jsp 2001/09/10 13:13:05 1.2
@@ -1,5 +1,5 @@
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="comp" %>
-<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
+<%@ taglib uri="/WEB-INF/extensions.tld" prefix="ext" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%-- Edit an Address object
@@ -7,9 +7,8 @@
@param compName UI Component name. Use as prefix for html fields and
sub-components
--%>
<%-- Retrieve parameters from component context, and declare them as page variable
--%>
-<comp:useAttribute id="prefix" name="property" classname="java.lang.String"/>
-<comp:importAttribute name="bean" />
-
+<comp:useAttribute id="addr" name="address" scope="page" />
+<comp:useAttribute id="prefix" name="compName" classname="java.lang.String"/>
<%-- Add a separator tothe component name, in order to have html fields prefix name
: 'compName.'--%>
<% prefix = prefix + "."; %>
@@ -23,9 +22,7 @@
<%-- Declare an html input field.
--%>
<%-- We use a tag that extends Struts 'text' tag. This extension add
--%>
<%-- attribute 'prefix', allowing to give a prefix to the normal name
--%>
-
- <html:text name="bean" property='<%=prefix+"street1"%>' size="50"/>
-
+ <ext:text name="addr" prefix="<%=prefix%>" property="street1" size="50"/>
</td>
</tr>
@@ -34,7 +31,7 @@
Street (con't)
</th>
<td align="left">
- <ext:text property="street2" size="50"/>
+ <ext:text prefix="<%=prefix%>" name="addr" property="street2" size="50"/>
</td>
</tr>
@@ -43,7 +40,7 @@
City
</th>
<td align="left">
- <ext:text property="city" size="50"/>
+ <ext:text prefix="<%=prefix%>" name="addr" property="city" size="50"/>
</td>
</tr>
@@ -52,7 +49,7 @@
Country
</th>
<td align="left">
- <ext:text property="country" size="50"/>
+ <ext:text prefix="<%=prefix%>" name="addr" property="country" size="50"/>
</td>
</tr>
@@ -61,7 +58,7 @@
Zip code
</th>
<td align="left">
- <ext:text property="zipCode" size="50"/>
+ <ext:text prefix="<%=prefix%>" name="addr" property="zipCode" size="50"/>
</td>
</tr>
1.2 +18 -15
jakarta-struts/contrib/tiles/web/doc/tutorial/invoice/editAddress.jsp
Index: editAddress.jsp
===================================================================
RCS file:
/home/cvs/jakarta-struts/contrib/tiles/web/doc/tutorial/invoice/editAddress.jsp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- editAddress.jsp 2001/08/01 14:36:47 1.1
+++ editAddress.jsp 2001/09/10 13:13:05 1.2
@@ -1,17 +1,18 @@
-<%@ taglib uri="/WEB-INF/tiles.tld" prefix="comp" %>
-<%@ taglib uri="/WEB-INF/extensions.tld" prefix="ext" %>
+<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
+<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%-- Edit an Address object
- @param address An address object to edit.
- @param compName UI Component name. Use as prefix for html fields and
sub-components
+ @param bean An address object to edit.
+ @param beanName The path to add between the bean and the properties to edit.
--%>
<%-- Retrieve parameters from component context, and declare them as page variable
--%>
-<comp:useAttribute id="addr" name="address" scope="page" />
-<comp:useAttribute id="prefix" name="compName" classname="java.lang.String"/>
-<%-- Add a separator tothe component name, in order to have html fields prefix name
: 'compName.'--%>
-<% prefix = prefix + "."; %>
+<tiles:useAttribute id="beanName" name="property" classname="java.lang.String"
ignore="true" />
+<tiles:importAttribute name="bean" />
+<%-- Add a '.' separator to the path (beanName), in order to access the property
from the given bean --%>
+<% if( beanName == null ) beanName = ""; else if (beanName !="" ) beanName =
beanName + "."; %>
+
<table border="0" width="100%">
<tr>
@@ -20,9 +21,11 @@
</th>
<td align="left">
<%-- Declare an html input field.
--%>
- <%-- We use a tag that extends Struts 'text' tag. This extension add
--%>
- <%-- attribute 'prefix', allowing to give a prefix to the normal name
--%>
- <ext:text name="addr" prefix="<%=prefix%>" property="street1" size="50"/>
+ <%-- We use the bean passed as parameter.
--%>
+ <%-- Property name is prefixed by the sub-bean name if any.
--%>
+
+ <html:text name="bean" property='<%=beanName+"street1"%>' size="50"/>
+
</td>
</tr>
@@ -31,7 +34,7 @@
Street (con't)
</th>
<td align="left">
- <ext:text prefix="<%=prefix%>" name="addr" property="street2" size="50"/>
+ <html:text property='<%=beanName+"street2"%>' size="50"/>
</td>
</tr>
@@ -40,7 +43,7 @@
City
</th>
<td align="left">
- <ext:text prefix="<%=prefix%>" name="addr" property="city" size="50"/>
+ <html:text name="bean" property='<%=beanName+"city"%>' size="50"/>
</td>
</tr>
@@ -49,7 +52,7 @@
Country
</th>
<td align="left">
- <ext:text prefix="<%=prefix%>" name="addr" property="country" size="50"/>
+ <html:text property='<%=beanName+"country"%>' size="50"/>
</td>
</tr>
@@ -58,7 +61,7 @@
Zip code
</th>
<td align="left">
- <ext:text prefix="<%=prefix%>" name="addr" property="zipCode" size="50"/>
+ <html:text property='<%=beanName+"zipCode"%>' size="50"/>
</td>
</tr>