title: Server goes into infinite loop while implementing Tiles with Velocity
body: <p><strong>EDIT:</strong>
  I am trying to integrate Tiles with Velocity using spring MVC.
  My server is going into infinite loop.
  The console reading of server is:
  I have marked the start of the loop as "-->".</p>
  
  <pre><code>--&gt; at org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:311)
      at org.apache.jsp.WEB_002dINF.views.layout_jsp._jspx_meth_tiles_005finsertAttribute_005f0(layout_jsp.java:102)
      at org.apache.jsp.WEB_002dINF.views.layout_jsp._jspService(layout_jsp.java:69)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
      at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:605)
      at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:544)
      at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
      at org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:684)
      at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:678)
      at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:103)
      at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:96)
      at org.apache.tiles.renderer.impl.TemplateAttributeRenderer.write(TemplateAttributeRenderer.java:44)
      at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
      at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:670)
      at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:690)
      at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:644)
      at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:627)
      at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:321)
      at org.apache.tiles.renderer.impl.DefinitionAttributeRenderer.write(DefinitionAttributeRenderer.java:56)
      at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
      at org.apache.tiles.renderer.impl.ChainedDelegateAttributeRenderer.write(ChainedDelegateAttributeRenderer.java:76)
      at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
      at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:670)
      at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:336)
      at org.apache.tiles.template.InsertAttributeModel.renderAttribute(InsertAttributeModel.java:210)
      at org.apache.tiles.template.InsertAttributeModel.end(InsertAttributeModel.java:126)
  --&gt; at org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:311)
      at org.apache.jsp.WEB_002dINF.views.layout_jsp._jspx_meth_tiles_005finsertAttribute_005f0(layout_jsp.java:102)
      at org.apache.jsp.WEB_002dINF.views.layout_jsp._jspService(layout_jsp.java:69)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
      at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:605)
      at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:544)
      at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:954)
      at org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:684)
      at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:678)
      at org.apache.tiles.jsp.context.JspTilesRequestContext.include(JspTilesRequestContext.java:103)
      at org.apache.tiles.jsp.context.JspTilesRequestContext.dispatch(JspTilesRequestContext.java:96)
      at org.apache.tiles.renderer.impl.TemplateAttributeRenderer.write(TemplateAttributeRenderer.java:44)
      at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
      at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:670)
      at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:690)
      at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:644)
      at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:627)
      at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:321)
      at org.apache.tiles.renderer.impl.DefinitionAttributeRenderer.write(DefinitionAttributeRenderer.java:56)
      at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
      at org.apache.tiles.renderer.impl.ChainedDelegateAttributeRenderer.write(ChainedDelegateAttributeRenderer.java:76)
      at org.apache.tiles.renderer.impl.AbstractBaseAttributeRenderer.render(AbstractBaseAttributeRenderer.java:106)
      at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:670)
      at org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:336)
      at org.apache.tiles.template.InsertAttributeModel.renderAttribute(InsertAttributeModel.java:210)
      at org.apache.tiles.template.InsertAttributeModel.end(InsertAttributeModel.java:126)
      at org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:311)
  --&gt; at org.apache.jsp.WEB_002dINF.views.layout_jsp._jspx_meth_tiles_005finsertAttribute_005f0(layout_jsp.java:102)
  
      AND SO ON...
  </code></pre>
  
  <p>I have the following code in my servlet-context.xml</p>
  
  <pre><code>&lt;beans:bean id="tilesViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
          &lt;beans:property name="viewClass" value="org.springframework.web.servlet.view.tiles2.TilesView"/&gt;
          &lt;beans:property name="order" value="0"/&gt;
      &lt;/beans:bean&gt;
  
      &lt;beans:bean id="velocityConfig" class="org.springframework.web.servlet.view.velocity.VelocityConfigurer"&gt;
          &lt;beans:property name="resourceLoaderPath" value="/WEB-INF/views/" /&gt;
      &lt;/beans:bean&gt;
  
      &lt;beans:bean id="viewResolver" class="org.springframework.web.servlet.view.velocity.VelocityViewResolver"&gt;
          &lt;beans:property name="cache" value="true"/&gt;
          &lt;beans:property name="prefix" value=""/&gt;
          &lt;beans:property name="suffix" value=".vm"/&gt;
          &lt;beans:property name="order" value="2"/&gt;
      &lt;/beans:bean&gt;
  
      &lt;beans:bean id="tilesConfigurer" 
      class="org.springframework.web.servlet.view.tiles2.TilesConfigurer"&gt;
      &lt;beans:property name="definitions"&gt;
          &lt;beans:list&gt;
              &lt;beans:value&gt;/WEB-INF/tiles.xml&lt;/beans:value&gt;
          &lt;/beans:list&gt;
      &lt;/beans:property&gt;
      &lt;/beans:bean&gt;
  </code></pre>
  
  <p>My WEB-INF/views/layout.jsp is</p>
  
  <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1"
      pageEncoding="ISO-8859-1"%&gt;
  &lt;%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
  &lt;title&gt;&lt;tiles:insertAttribute name="title"/&gt;  &lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;tiles:insertAttribute name="body"/&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and finally my velocity file home.vm is:</p>
  
  <pre><code>&lt;html&gt;
  &lt;body&gt;
  &lt;h1&gt;
      Hello world!  
  &lt;/h1&gt;
  ##This is comment
  &lt;P&gt;  The time on the server is ${serverTime}. &lt;/P&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>tiles.xml :</p>
  
  <pre><code>&lt;tiles-definitions&gt;
    &lt;definition name="base.definition" template="/WEB-INF/views/layout.jsp"&gt;
               &lt;put-attribute name="title" value="" /&gt;
               &lt;put-attribute name="body" value="" /&gt;
    &lt;/definition&gt;
  
    &lt;definition name="home" extends="base.definition"&gt;
               &lt;put-attribute name="title" value="home" /&gt;
               &lt;put-attribute name="body" value="/WEB-INF/views/home.vm" /&gt;
    &lt;/definition&gt;
  &lt;tiles-definitions&gt;
  </code></pre>
  
  <p>I read that, you can use multiple view resolver with specifying the order.
  SO I specified the order of the view resolver.</p>
  
  <p>I am pretty new to this technology. Please help.
  Thanks in advance.</p>