Struts2 tiles plugin and tiles configuration file in subfolders issue

81 Views Asked by At

As release note reports:

This version embeds the Apache Tiles by directly coping the source code of the library. The Apache Tiles project has retired and right now it's in the attic - no development is happening around this project. Struts committers decided to copy all the required source code to continue undisturbed support for the the Struts 2 Tiles plugin.

So i want to clean up my app from old tiles libs and full migrate to Struts Tiles plugin, but if i replace the old listener (not included in new libs)

org.apache.tiles.extras.complete.CompleteAutoloadTilesListener 

with

org.apache.struts2.tiles.StrutsTilesListener

The listener founds only tiles\*.xml definition in WEB-INF folder and ignore subfolders (for example WEB-INF/foo/tiles/tiles-foo.xml)

I try to use this parameter configured with the pattern of old CompleteAutoloadTilesListener but does not work because it expects a single file or a list and not a pattern.

<context-param>
        <param-name>org.apache.tiles.definition.DefinitionsFactory.DEFINITIONS_CONFIG</param-name>
        <param-value>/WEB-INF/**/tiles*.xml,classpath*:META-INF/**/tiles*.xml</param-value>
    </context-param>

At the moment the only way to make it work is to indicate the entire list of tiles*.xml but this is an old application and i have so many files, i risk losing some.

I can try to leave the only tiles-extras and continue to use the old CompleteAutoloadTilesListener, but i think i may run into future compatibility issues.

Has anyone found a workaround?

thanks

1

There are 1 best solutions below

2
On

You don't need to specify any params for configuration. The definitions should be placed in WEB-INF or resources using tiles*.xml pattern.

Tiles plugin - Usage:

As from Struts 2.3.28, the plugin automatically loads all Tiles definitions matching the following pattern tiles*.xml.