ITeye博客

tiles 2.1.3 bug: 'ignore' doesn't work for insertDefinition tag

lerluc · 2009-10-03 05:48 · Apache · Struts · XML · JSP · Markdown

<tiles:insertDefinition name="def" ignore="true"/>

Description: "If this attribute is set to true, and the attribute specified by the name does not exist, simply return without writing anything. The default value is false, which will cause a runtime exception to be thrown."

But in fact, when "def" isn't configured it throws exception regardless of ignore="true".

Workaround:

  1. download src of tiles-2.1.3
  2. tiles-jsp/src/main/java/org/apache/tiles/jsp/taglib/InsertDefinitionTag.java line 65: (patched)
    protected void renderContext() {
    	boolean isValid = container.isValidDefinition(name, pageContext);
        if(isValid || !ignore)
        	container.render(name, pageContext);
    }
  1. compile a tiles-jsp.jar and replace the original one or use this one (compiled with jdk1.6. mind the version!)

Another bug with "ignore" for insertAttribute tag

<tiles:insertAttribute name="attr" ignore="true"/>

refer to JIRA for the patch

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。