title: Does Thymeleaf have something like JSP tags?
body: <p>I <strong>don't</strong> mean taglibs, I'm using a JSP tag to do something like this:</p>
  
  <p><strong><em>ChildPage.jsp</em></strong>:</p>
  
  <pre><code>&lt;%@ page contentType="text/html" pageEncoding="UTF-8" %&gt;
  &lt;%@ taglib prefix="t" tagdir="/WEB-INF/tags" %&gt;
  
  &lt;t:layout&gt;
      &lt;jsp:attribute name="head"&gt;
          &lt;link href="css/custom.css" type="text/css" rel="stylesheet"/&gt;
      &lt;/jsp:attribute&gt;
      &lt;jsp:attribute name="scripts"&gt;
          &lt;script src="js/custom.js"&gt;&lt;/script&gt;
      &lt;/jsp:attribute&gt;
      &lt;jsp:body&gt;
          &lt;p&gt;This is from the child page&lt;/p&gt;
      &lt;/jsp:body&gt;
  &lt;/t:layout&gt;
  </code></pre>
  
  <p><strong><em>layout.tag</em></strong>:</p>
  
  <pre><code>&lt;%@ tag description="Layout template" pageEncoding="UTF-8" %&gt;
  &lt;%@ attribute name="head" fragment="true" %&gt;
  &lt;%@ attribute name="scripts" fragment="true" %&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
      &lt;head&gt;
          &lt;link href="css/main.css" type="text/css" rel="stylesheet"/&gt;
          &lt;jsp:invoke fragment="head"/&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div id="body"&gt;
              &lt;p&gt;This is from the parent or "layout"&lt;/p&gt;
              &lt;jsp:doBody/&gt;
          &lt;/div&gt;
          &lt;div id="footer"&gt;
              &lt;script src="js/main.js"&gt;&lt;/script&gt;
              &lt;jsp:invoke fragment="scripts"/&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong><em>When rendered</em></strong>:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
      &lt;head&gt;
          &lt;link href="css/main.css" type="text/css" rel="stylesheet"/&gt;
          &lt;link href="css/custom.css" type="text/css" rel="stylesheet"/&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;div id="body"&gt;
              &lt;p&gt;This is from the parent or "layout"&lt;/p&gt;
              &lt;p&gt;This is from the child page&lt;/p&gt;
          &lt;/div&gt;
          &lt;div id="footer"&gt;
              &lt;script src="js/main.js"&gt;&lt;/script&gt;
              &lt;script src="js/custom.js"&gt;&lt;/script&gt;
          &lt;/div&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This allows me to include scripts in the header section of the JSP from both the  layout and child pages. Same for the body and footer.</p>
  
  <p>I've read through Thymeleaf docs/examples but maybe I'm not understanding correctly as it doesn't look like I can do what I am trying to achieve.</p>
  
  <p>The reason why I have "inverted" what seems like a simple include is every page that I have includes certain scripts and a header section, but my child pages also have scripts to be imported and stylesheets to be included.</p>
  
  <p>Can I achive this somehow? Am I doing this wrong?</p>