This is a good summary, and I can add one item.  To specify which files to
use for your tiles definition config file, you can add the following to your
web.xml:

    <context-param>
        <param-name>org.apache.tiles.DEFINITIONS_CONFIG</param-name>
        <param-value>tiles-defs-1.xml, tiles-defs-2.xml</param-value>
        <description><![CDATA[Location of the Tiles2 config
files]]></description>
    </context-param>

The filenames are relative to your web-app root.  Normally these would go in
your WEB-INF folder, and so you would use /WEB-INF/tiles-def.xml.

I'm using org.apache.tiles.listener.TilesListener instead of
org.apache.struts2.tiles.StrutsTilesListener, but the context-param should
be picked up by the latter too.

-- David
 


-----Original Message-----
From: Rick Schumeyer [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 11, 2007 12:50 PM
To: Struts Users Mailing List
Subject: Re: Problems getting started with Tiles2/S2


I can now answer my own question regarding Struts2/Tiles2.  I hope this 
information helps someone else.

I frankly have little grasp of the relationship between S2 and T2, but 
this information here works for me.  If anything is incorrect or 
misleading I would love to know about it.

This information applies to Struts 2.0.6.  This version is only 
compatible with whatever version of tiles is included.  As is stated in 
many places, it does not work with the current latest version of Tiles, 
2.0.3.

So, if you are trying to use Tiles 2.0.3 or later...don't read the rest 
of this message.

In your web.xml you will need a section like this:
    <listener>
        <listener-class>
            org.apache.struts2.tiles.StrutsTilesListener
        </listener-class>
    </listener>

In the same directory you need a file called tiles.xml (I'm not sure how 
this is found...I saw someone else who has a file called tiles-defs.xml)
THIS IS IMPORTANT:  Use the DTD below regardless of what you see in 
other documentation.

Notice the use of "put" and not "put-attribute" that you may have seen 
elsewhere.


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tiles-definitions PUBLIC
       "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
       "http://struts.apache.org/dtds/tiles-config_2_0.dtd";>

<tiles-definitions>

        <definition name="homeTiles" template="/layout/layout.jsp">
          <put name="title" value="Home"/>
          <put name="header"  value="/test/header.jsp" />
          <put name="menu" value="/test/menu.jsp"/>
          <put name="body" value="/test/home.jsp"/>
          <put name="footer" value="/test/footer.jsp"/>
        </definition>

</tiles-definitions>

And in layout.jsp use:

<%@ taglib uri="http://tiles.apache.org/tags-tiles"; prefix="tiles"%>

Combined with statements like:

<tiles:insertAttribute name="header" />

Good luck.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to