0

I have a problem with tiles

I have a template (mainLayout) which does basically the following:

<html>
<body>
   ...
   <jsp:include page="/services" />
   ...
</body>
</html>

The url /services is served by a Spring controller which uses Tiles3. The /services url is using a different layout (rawLayout) which just outputs a jsp.

The problem is that the code is generating a stackoverflow error. Actually, when trying to render the /services url with a raw layout, Tiles is actually switching to mainLayout.

I debugged Tiles, and even though the definition is correct (rawLayout), the BasicTilesContainer::getAttributeContext method is switching back to the originating layout (mainLayout). It seems that Tiles is not using the template from the definition, but takes it from an execution stack.

My tiles definition:

<definition name="main" template="/WEB-INF/tiles/layout/mainLayout.jsp">
    <put-attribute name="content" value=""/>
</definition>
<definition name="full" template="/WEB-INF/tiles/layout/fullLayout.jsp">
    <put-attribute name="content" value=""/>
</definition>

<definition name="services" extends="full">
    <put-attribute name="content" value="/WEB-INF/jsp/services.jsp" />
</definition>

I hope this is clear enough.

Thanks

benjamin.d
  • 2,801
  • 3
  • 23
  • 35
  • My guess is that it's infinitely looping because you call `/services`, which is inappropriately using `mainLayout`, which in turn calls `/services`, which uses `mainLayout`, which...you get the point. So the question is: Why is `/services` using `mainLayout` instead of `rawLayout`. For that, I think we need to see your tiles config (should be a bunch of XML files that define the "tiles"). – CodeChimp Apr 23 '14 at 19:40
  • @CodeChimp: Yes I agree this is the problem. I added the XML tiles definition entries. – benjamin.d Apr 24 '14 at 07:03
  • I never seen an empty `` before. What happens if you remove that in the `full` definition? – CodeChimp Apr 24 '14 at 11:29
  • @CodeChimp Same thing – benjamin.d Apr 24 '14 at 11:48
  • Is your services.jsp calling something that might be using the same `services` tile definition? – CodeChimp Apr 24 '14 at 11:51

0 Answers0