Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.1.3, 2.1.4
-
None
-
Windows, WAS 6.1, Struts 2
-
Important
Description
I found out that when creating a wildcard configuration with a cascade="true" attribute inside, this attribute doesn't actualy apply to the actual resulting cached configuration.
Sample configuration xml:
<definition name="abstract.one" template="/WEB-INF/jsp/one.jsp">
</definition>
<definition name="abstract.two" template="/WEB-INF/jsp/two.jsp">
</definition>
<definition name="..*" extends="abstract.one">
<put-attribute name="abstract.one-param1" value="/WEB-INF/jsp/param1.jsp" />
<put-attribute name="abstract.one-param2" value="abstract.two" />
<put-attribute name="abstract.two-param1" value="/WEB-INF/jsp/
/
{2}/
{3}.jsp" cascade="true"/>
</definition>
Looking at the source code, the problem seems to be in method replaceDefinition of class CachingLocaleUrlDefinitionDAO.java
If I replace the method to the following, everything is ok:
protected Definition replaceDefinition(Definition d, String name,
Map<Integer, String> vars) {
Definition nudef = new Definition();
nudef.setExtends(replace(d.getExtends(), vars));
nudef.setName(name);
nudef.setPreparer(replace(d.getPreparer(), vars));
nudef.setTemplateAttribute(replaceVarsInAttribute(d
.getTemplateAttribute(), vars));
Set<String> localAttributeNames = d.getLocalAttributeNames();
if (localAttributeNames != null && !localAttributeNames.isEmpty()) {
for (String attributeName : localAttributeNames)
}
/** this is my hack! **/
Set<String> cascadedAttributeNames = d.getCascadedAttributeNames();
if (cascadedAttributeNames != null && !cascadedAttributeNames.isEmpty()) {
for (String attributeName : cascadedAttributeNames)
}
return nudef;
}
Please fix it in next version of Tiles 2.1.x. I don't know if this is working in Tiles 2.2.x, since there is no Struts plugin for Tiles 2.2.x yet.... (who should I blame?)
Attachments
Attachments
Issue Links
- relates to
-
TILES-454 PatternUtil.replacePlaceholders does not work with null template attibute and cascaded attributes
- Closed