You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Zach Bailey <zn...@wethecitizens.com> on 2009/10/23 00:30:08 UTC
Infinite Loop in Tiles when using jsp:include
Hello,
I am using Tiles 2.1.3 in Spring MVC. I have two definitions/pages set
up in the following way:
<definition name="page1" template="page1.jsp"/>
page1.jsp:
<h1>Page 1</h1>
...some content...
<jsp:include page="/modules/moduleOne"/>
The URL "/modules/moduleOne" is mapped to a Spring MVC controller that
simply returns the tile definition named "moduleOne":
<definition name="moduleOne" template="moduleOne.jsp"/>
moduleOne.jsp:
<p>I am a module, short and stout.</p>
When I hit the URL "/modules/moduleOne" directly, the page renders
fine. However, when I hit the URL for page1, the request dispatcher
essentially gets stuck in an endless loop, with the condensed stack
looking like this:
- pageOne.jsp
- Jsp Servlet/App Dispatcher/Filter Chain
ServletTilesRequestContext.include(String) line: 260
ServletTilesRequestContext.dispatch(String) line: 220
TemplateAttributeRenderer.write(Object, Attribute,
TilesRequestContext) line: 44
TemplateAttributeRenderer(AbstractBaseAttributeRenderer).render
(Attribute, TilesRequestContext) line: 103
BasicTilesContainer.render(Attribute, TilesRequestContext) line: 669
BasicTilesContainer.render(TilesRequestContext, AttributeContext)
line: 689
BasicTilesContainer.render(TilesRequestContext, Definition) line: 643
BasicTilesContainer.render(TilesRequestContext, String) line: 626
BasicTilesContainer.render(String, Object...) line: 322
- TilesView.render()
- Spring Dispatcher Servlet
- JspRuntimeLibrary.include()
- pageOne.jsp
The logic that is grabbing my attention as doing something wrong is
the code in BasicAttributeContext.inherit (which calls
BasicAttributeContext.inheritParentTemplateAttribute) which "inherits"
the definition, but only if the parent is empty. In this situation,
this logic is wrong - due to the "include", the child/subcontext's
template attribute should ALWAYS be honored. Am I off base here?
Note that when including the module from a page which already extends
a parent template, this behavior does not occur:
<definition name="page2" extends="someLayout">
<put-attribute name="content" value="page2.jsp"/>
</definition>
page2.jsp:
<h1>Page 2</h1>
...some content...
<jsp:include page="/modules/moduleOne"/>
This works fine.
Let me know if you need more information, or if I need to put together
a simple project that replicates this behavior.
Thanks,
-Zach Bailey
Re: Infinite Loop in Tiles when using jsp:include
Posted by Antonio Petrelli <an...@gmail.com>.
2009/10/23 Zach Bailey <zn...@wethecitizens.com>:
> Let me know if you need more information, or if I need to put together a
> simple project that replicates this behavior.
It's hard to say it here. Try using Tiles 2.1.4 "candidate" here:
http://people.apache.org/builds/tiles/2.1.4/
If it still does not work, please open a JIRA issue attaching a sample
project with source, preferably in Maven format.
Thanks
Antonio