title: org.apache.tiles.request.render.CannotRenderException: An exception occurred processing JSP page /WEB-INF/views/tileslayout/mainlayout.jsp
body: <p><strong>New to Taglib</strong> </p>
  
  <p>I am developing a Web application using spring and tiles concept. when I try inserting a Taglib directory to my body layout part in tiles I am getting the following exception.</p>
  
  <p>I tried inserting taglib under mainlayout.jsp alone but that didnt work. since each jsp works seperately we need to insert it in all the jsp. If I take out the Taglib from my bodypart.jsp the page is working fine. </p>
  
  <pre><code>type Exception report
  
  message Request processing failed; nested exception is org.apache.tiles.request.render.CannotRenderException: An exception occurred processing JSP page /WEB-INF/views/tileslayout/mainlayout.jsp at line 23
  
  description The server encountered an internal error that prevented it from fulfilling this request.
  
  exception
  
  org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.apache.tiles.request.render.CannotRenderException: An exception occurred processing JSP page /WEB-INF/views/tileslayout/mainlayout.jsp at line 23
  
  20: 
  21: &lt;body&gt;
  22:     &lt;tiles:insertAttribute name="header" /&gt;
  23:     &lt;tiles:insertAttribute name="body" /&gt;
  24:     &lt;tiles:insertAttribute name="footer" /&gt;
  25:     &lt;tiles:insertAttribute name="scriptjs" /&gt;
  26: &lt;/body&gt;
  
  
  Stacktrace:
      org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  
  root cause
  
  org.apache.tiles.request.render.CannotRenderException: An exception occurred processing JSP page /WEB-INF/views/tileslayout/mainlayout.jsp at line 23
  
  20: 
  21: &lt;body&gt;
  22:     &lt;tiles:insertAttribute name="header" /&gt;
  23:     &lt;tiles:insertAttribute name="body" /&gt;
  24:     &lt;tiles:insertAttribute name="footer" /&gt;
  25:     &lt;tiles:insertAttribute name="scriptjs" /&gt;
  26: &lt;/body&gt;
  
  
  Stacktrace:
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:399)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221)
      org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59)
      org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:132)
      org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
      org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
      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:970)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  
  root cause
  
  java.io.IOException: An exception occurred processing JSP page /WEB-INF/views/tileslayout/mainlayout.jsp at line 23
  
  20: 
  21: &lt;body&gt;
  22:     &lt;tiles:insertAttribute name="header" /&gt;
  23:     &lt;tiles:insertAttribute name="body" /&gt;
  24:     &lt;tiles:insertAttribute name="footer" /&gt;
  25:     &lt;tiles:insertAttribute name="scriptjs" /&gt;
  26: &lt;/body&gt;
  
  
  Stacktrace:
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:466)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      org.apache.tiles.request.servlet.ServletRequest.forward(ServletRequest.java:265)
      org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:228)
      org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57)
      org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221)
      org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59)
      org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:132)
      org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
      org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
      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:970)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  
  root cause
  
  java.io.IOException: JSPException including path '/WEB-INF/views/jsp/barcode.jsp'.
      org.apache.tiles.request.servlet.ServletUtil.wrapServletException(ServletUtil.java:61)
      org.apache.tiles.request.jsp.JspRequest.doInclude(JspRequest.java:125)
      org.apache.tiles.request.AbstractViewRequest.dispatch(AbstractViewRequest.java:47)
      org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
      org.apache.tiles.request.render.ChainedDelegateRenderer.render(ChainedDelegateRenderer.java:68)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
      org.apache.tiles.template.InsertAttributeModel.renderAttribute(InsertAttributeModel.java:188)
      org.apache.tiles.template.InsertAttributeModel.execute(InsertAttributeModel.java:132)
      org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:299)
      org.apache.jsp.WEB_002dINF.views.tileslayout.mainlayout_jsp._jspx_meth_tiles_005finsertAttribute_005f3(mainlayout_jsp.java:272)
      org.apache.jsp.WEB_002dINF.views.tileslayout.mainlayout_jsp._jspService(mainlayout_jsp.java:140)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      org.apache.tiles.request.servlet.ServletRequest.forward(ServletRequest.java:265)
      org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:228)
      org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57)
      org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221)
      org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59)
      org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:132)
      org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
      org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
      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:970)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  
  root cause
  
  java.lang.IllegalStateException: Neither BindingResult nor plain target object for bean name 'command' available as request attribute
      org.springframework.web.servlet.support.BindStatus.&lt;init&gt;(BindStatus.java:144)
      org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:168)
      org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.resolveCssClass(AbstractHtmlElementTag.java:462)
      org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeOptionalAttributes(AbstractHtmlElementTag.java:432)
      org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:423)
      org.springframework.web.servlet.tags.form.LabelTag.writeTagContent(LabelTag.java:91)
      org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:84)
      org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80)
      org.apache.jsp.WEB_002dINF.views.jsp.barcode_jsp._jspx_meth_s_005flabel_005f0(barcode_jsp.java:339)
      org.apache.jsp.WEB_002dINF.views.jsp.barcode_jsp._jspx_meth_s_005fform_005f0(barcode_jsp.java:206)
      org.apache.jsp.WEB_002dINF.views.jsp.barcode_jsp._jspService(barcode_jsp.java:156)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:934)
      org.apache.jasper.runtime.PageContextImpl.doInclude(PageContextImpl.java:679)
      org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:673)
      org.apache.tiles.request.jsp.JspRequest.doInclude(JspRequest.java:123)
      org.apache.tiles.request.AbstractViewRequest.dispatch(AbstractViewRequest.java:47)
      org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
      org.apache.tiles.request.render.ChainedDelegateRenderer.render(ChainedDelegateRenderer.java:68)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
      org.apache.tiles.template.InsertAttributeModel.renderAttribute(InsertAttributeModel.java:188)
      org.apache.tiles.template.InsertAttributeModel.execute(InsertAttributeModel.java:132)
      org.apache.tiles.jsp.taglib.InsertAttributeTag.doTag(InsertAttributeTag.java:299)
      org.apache.jsp.WEB_002dINF.views.tileslayout.mainlayout_jsp._jspx_meth_tiles_005finsertAttribute_005f3(mainlayout_jsp.java:272)
      org.apache.jsp.WEB_002dINF.views.tileslayout.mainlayout_jsp._jspService(mainlayout_jsp.java:140)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
      org.apache.tiles.request.servlet.ServletRequest.forward(ServletRequest.java:265)
      org.apache.tiles.request.servlet.ServletRequest.doForward(ServletRequest.java:228)
      org.apache.tiles.request.AbstractClientRequest.dispatch(AbstractClientRequest.java:57)
      org.apache.tiles.request.render.DispatchRenderer.render(DispatchRenderer.java:47)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:259)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:397)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:238)
      org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:221)
      org.apache.tiles.renderer.DefinitionRenderer.render(DefinitionRenderer.java:59)
      org.springframework.web.servlet.view.tiles3.TilesView.renderMergedOutputModel(TilesView.java:132)
      org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:303)
      org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1244)
      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:970)
      org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
      org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
  </code></pre>
  
  <p>tiles-def.xml</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_3_0.dtd"&gt;
  &lt;tiles-definitions&gt;
  
      &lt;definition name="bodypage" extends="base.definition"&gt;
          &lt;put-attribute name="title" value="Barcode Generation"&gt;&lt;/put-attribute&gt;
          &lt;put-attribute name="body" value="/WEB-INF/views/jsp/badypart.jsp"&gt;&lt;/put-attribute&gt;
      &lt;/definition&gt; 
  
  &lt;/tiles-definitions&gt;
  </code></pre>
  
  <p>tiles-template.xml</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_3_0.dtd"&gt;
  &lt;tiles-definitions&gt;
      &lt;definition name="base.definition" template="/WEB-INF/views/tileslayout/mainlayout.jsp"&gt;
          &lt;put-attribute name="title" value=""&gt;&lt;/put-attribute&gt;
          &lt;put-attribute name="stylecss" value="/WEB-INF/views/jsp/firststylecss.jsp"&gt;&lt;/put-attribute&gt;
          &lt;put-attribute name="header" value="/WEB-INF/views/jsp/firstheader.jsp"&gt;&lt;/put-attribute&gt;
          &lt;put-attribute name="body" value=""&gt;&lt;/put-attribute&gt;
          &lt;put-attribute name="footer" value="/WEB-INF/views/jsp/firstfooter.jsp"&gt;&lt;/put-attribute&gt;
          &lt;put-attribute name="scriptjs" value="/WEB-INF/views/jsp/firstscriptjs.jsp"&gt;&lt;/put-attribute&gt;
      &lt;/definition&gt;
  
  
  
  &lt;/tiles-definitions&gt;
  </code></pre>
  
  <p>mainlayout.xml</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;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%&gt;
  &lt;%@ taglib uri="http://www.springframework.org/tags/form" prefix="s"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html lang="en" class="no-js"&gt;
  &lt;head&gt;
  &lt;c:set var="webapp_path" value="${pageContext.request.contextPath}"
      scope="session" /&gt;
  &lt;link type="image/x-icon"
      href="&lt;c:out value='${webapp_path}'/&gt;/images/favicon.ico" rel="icon"&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;meta name="viewport"
      content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"&gt;
  &lt;meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /&gt;
  &lt;title&gt;&lt;tiles:insertAttribute name="title" ignore="true" /&gt;&lt;/title&gt;
  &lt;tiles:insertAttribute name="stylecss" /&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
      &lt;tiles:insertAttribute name="header" /&gt;
      &lt;tiles:insertAttribute name="body" /&gt;
      &lt;tiles:insertAttribute name="footer" /&gt;
      &lt;tiles:insertAttribute name="scriptjs" /&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>bodypart.jsp</p>
  
  <pre><code>&lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt;
  &lt;%@taglib uri="http://www.springframework.org/tags/form" prefix="s"%&gt;
  
      &lt;div class="container"&gt;
          Hello World
          Here would like to use to spring form and jslt tags
      &lt;/div&gt;
  </code></pre>