title: Why would I use a templating engine? jsp include and jstl vs tiles, freemarker, velocity, sitemesh
body: <p>I'm about to choose to way to organize my view (with spring-mvc, but that shouldn't matter much)</p>
  
  <p>There are 6 options as far as I see (though they are not mutually exclusive):</p>
  
  <ul>
  <li><em>Tiles</em></li>
  <li><em>Sitemesh</em></li>
  <li><em>Freemarker</em></li>
  <li><em>Velocity</em></li>
  <li><code>&lt;jsp:include&gt;</code></li>
  <li><code>&lt;%@ include file=".."&gt;</code></li>
  </ul>
  
  <p><em>Tiles</em> and <em>Sitemesh</em> can be grouped; so can <em>Freemarker</em> and <em>Velocity</em>. Which one within each group to use is not a matter of this discussion, there are enough questions and discussions about it.</p>
  
  <p><a href="http://www.javaworld.com/javaworld/jw-01-2002/jw-0104-tilestrut.html" rel="noreferrer">This is an interesting read</a>, but can't quite convince me to use tiles.</p>
  
  <p>My question is - <em>what do these frameworks give that can't be properly done with</em> <code>&lt;@ include file=".."&gt;</code> and JSTL. Main points (some taken from the article):</p>
  
  <ol>
  <li><p><strong>Including parts of pages, like header and footer</strong> - there isn't a difference between:</p>
  
  <pre><code>&lt;%@ include file="header.jsp" %&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;tiles:insert page="header.jsp" /&gt;
  </code></pre></li>
  <li><p><strong>Defining parameters in the header</strong> - like title, meta tags, etc. This is very important, especially from SEO point of view. With the templating options you can simply define a placeholder which each page should define. But so you can in jsp with <em>JSTL</em>, using <code>&lt;c:set&gt;</code> (in the including page) and <code>&lt;c:out&gt;</code> (in the included page)</p></li>
  <li><p><strong>Layout reorganization</strong> - if you want to move the breadcrumb above the menu, or the login box above another side-panel. If page inclusions (with jsp) is not well organized, you might need to change every single page in such cases. But if your layout is not overly complex, and you put the common things in header/footer, there is nothing to worry about.</p></li>
  <li><p><strong>Coupling between the common components and the specific content</strong> - I don't find an issue with this. If you want to reuse some fragment, move it to a page that doesn't include any header/footer, and include it wherever needed.</p></li>
  <li><p><strong>Efficiency</strong> - <code>&lt;%@ include file="file.jsp" %&gt;</code> is more efficient than anything else, because it is compiled once. All other options are parsed/executed many times.</p></li>
  <li><p><strong>Complexity</strong> - all non-jsp solutions require additional xml files, additional includes, pre-processor configurations, etc. This is both a learning curve and introducing more potential points of failure. Also, it makes support and changing more tedious - you have to check a number of files/configurations in order to understand what's happening.</p></li>
  <li><p><strong>Placeholders</strong> - do velocity/freemarker give anything more than JSTL? In JSTL you put placeholder, and use the model (placed in request or session scope, by controllers) to fill these placeholders.</p></li>
  </ol>
  
  <p>So, convince me that I should use any of the above frameworks instead of/in addition to plain JSP.</p>