title: org.apache.tiles.template.NoSuchAttributeException: Attribute 'body' not found
body: <h2><strong>-my stack trace</strong></h2>
  
  <pre><code>org.apache.tiles.template.NoSuchAttributeException: Attribute 'header' not found.
      org.apache.tiles.template.DefaultAttributeResolver.computeAttribute(DefaultAttributeResolver.java:49)
      org.apache.tiles.template.InsertAttributeModel.resolveAttribute(InsertAttributeModel.java:187)
      org.apache.tiles.template.InsertAttributeModel.start(InsertAttributeModel.java:107)
      org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:306)
      org.apache.jsp.WEB_002dINF.pages.layout_jsp._jspx_meth_tiles_005finsertAttribute_005f1(layout_jsp.java:142)
      org.apache.jsp.WEB_002dINF.pages.layout_jsp._jspService(layout_jsp.java:77)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
      org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:168)
      org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
      org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1243)
      org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1027)
      org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:971)
      org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:968)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:859)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:844)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:316)
      org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:126)
      org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:90)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
      org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
      org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:122)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
      org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
      org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
      org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:48)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
      org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:205)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
      org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:120)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
      org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
      org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
      org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:53)
      org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
      org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:91)
      org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
      org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:213)
      org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:176)
      org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
      org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
  
  **Note** The full stack trace of the root cause is available in the Apache Tomcat/7.0.47 logs.
  </code></pre>
  
  <p>home.jsp contains :</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;%@ page pageEncoding="UTF-8" %&gt;
  &lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt;
  &lt;%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%&gt;
  &lt;head&gt;
    &lt;%--  &lt;title&gt;&lt;tiles:getAsString name="title" /&gt;&lt;/title&gt; --%&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;tiles:insertAttribute name="body" /&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I'm trying to add tiles in my spring application but I'm getting <code>org.apache.tiles.template.NoSuchAttributeException: Attribute 'body' not found</code>.</p>
  
  <p>Below I mentioned my <code>tiles.xml</code> file:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;!DOCTYPE tiles-definitions PUBLIC 
      "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN" 
      "http://tiles.apache.org/dtds/tiles-config_2_1.dtd"&gt;
  &lt;tiles-definitions&gt;
      &lt;!-- definition name="base.definition" 
         template="/WEB-INF/layouts/classic.jsp"&gt;  
         &lt;put-attribute name="title" value="" /&gt;  
         &lt;put-attribute name="header" value="/WEB-INF/basefragments/header.jsp" /&gt;  
         &lt;put-attribute name="body" value="/WEB-INF/pages/home.jsp" /&gt;  
  
    &lt;/definition&gt;   --&gt;
   &lt;!-- Home Page --&gt;
    &lt;definition name="base.definition"   template="/WEB-INF/pages/temp.jsp" &gt;  
         &lt;put-attribute name="title" value="Home Page" /&gt;  
         &lt;put-attribute name="body" value="/WEB-INF/pages/home.jsp" /&gt;  
     &lt;/definition&gt;  
  &lt;/tiles-definitions&gt;
  </code></pre>