Thanks Antonio.  I finally got it working.  The app is now S2 (using plugin)
and S1 (no plugin) both using Tiles 2, and sharing the same tiles
definitions.  It works well.  The app was already configured to run S2/T2
(with plugin) and S1/T1 (with plugin).   I am now considering removing the
S2 plugin and simply using T2 dispatching.  This would allow me to use the
latest Tiles-2.0.4 version, instead of 2.0.3 which ships with Struts-2.0.8. 
As a summary, here are the steps I went thru:

1.  The web.xml file already contained the TilesListener for the S2
deployment.  The Listener class was changed for the new deployment:
        <listener>
                <listener-class>
                        org.apache.tiles.listener.TilesListener
                </listener-class>
        </listener>
2.  The web.xml file already contained context-param elems for
ContainerFactory and DEFINITIONS_CONFIG.  The Definitions config element
changed to the Tiles reference:
        <context-param>
                <param-name>org.apache.tiles.CONTAINER_FACTORY</param-name>
                <param-value>
                        org.apache.struts2.tiles.StrutsTilesContainerFactory
                </param-value> 
        </context-param>        
        <context-param>
                <param-name>
                        
org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
                </param-name>
                <param-value>/WEB-INF/tiles.xml</param-value>
        </context-param>

3.  In web.xml, added a reference to the Tiles Dispatch Servlet, and mapped
it to "*.tiles":
        <servlet>
                <servlet-name>Tiles Dispatch Servlet</servlet-name>
                <servlet-class>
                        org.apache.tiles.web.TilesDispatchServlet
                </servlet-class>
                <load-on-startup>3</load-on-startup>
        </servlet>

        <servlet-mapping>
                <servlet-name>Tiles Dispatch Servlet</servlet-name>
                <url-pattern>*.tiles</url-pattern>
        </servlet-mapping>

4.  In WEB-INF/lib, deleted the file 'struts-tiles-1.3.8.jar'.

5.  In struts-config.xml, removed the elements for the Tiles plugin, and the
TilesRequestProcessor.

6.  For the S1 actions, modified the struts-config.xml file to call the
Tile.  Note that the leading "/" is required, and the suffix ".tiles" is
used in the forward element.  (When using plugin, no leading "/" was used).

                <action path="/BookACruise"
                                
type="greetings.struts1.BookEarthCruiseSetupAction" >
                        <forward name="success" 
path="/BOOK_TRIP_TO_EARTH.tiles" />
                </action>

7.  Deleted the Tiles-1 mapping file, tiles-defs.xml, after moving the
definitions to the shared S2 tiles definitions file, tiles.xml.  (Note there
is no '.tiles' suffix, as I always specified when using the plugin)  Update
the definitions elements to the T2 syntax.
        <definition name="BOOK_TRIP_TO_EARTH"
                        extends="BaseScreenTemplate">
                <put-attribute name="title" value="Struts-1 with Tiles-2" 
type="string"/>
                <put-attribute name="contents" 
value="/jsp/BookEarthCruise.jspx" />
        </definition>

8.  Previously, had a special T1 template file, using T1 syntax, but
otherwise identical to the T2 template.  Deleted the T1-template file.

9.  Upgraded the jsp page syntax for the T2 tags.

Again, thank you for your help.  If you would like, I'd be happy to write
these steps more formally for use in  your Migration Guide.

- Ray Clough






Ray Clough-2 wrote:
> 
> It seems to me that the config info at 
> http://tiles.apache.org/tutorial/configuration.html is incomplete and in 
> error.  1)  There is no filter-mapping or servlet-mapping specified.  2) 
> the tiles definition files are specified both for the servlet and the 
> filter.  There is no statement about using one or the other.  The only 
> other instruction is the alternative of using a context parameter.
> 
> How is the mapping to be specified.  My guess is that if the filter and 
> servlet are mapped to "*.tiles", for example, all forwards to 
> "xxx.tiles" will be rendered by Tiles.  Is that correct?  Do both the 
> filter and servlet need to be mapped.  If either is not mapped, is it 
> actually used?  Must they be mapped to the same value?
> 
> Thanks,
> - Ray Clough
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Tiles-documentation-tf3923991.html#a11180978
Sent from the tiles users mailing list archive at Nabble.com.

Reply via email to