title: Spring MVC & Velocity : Template structure
body: <p>I'd like to achieve this kind of template functionality:</p>
  
  <ul>
  <li>Have a template defining header, footer, and common parts of complete (x)html webpage</li>
  <li>When returning String from <code>@Controller</code> it will define the view included to specific part of template</li>
  </ul>
  
  <p>Like this:</p>
  
  <p><strong>@Controller</strong></p>
  
  <pre><code>@RequestMapping(value = "/", method = RequestMethod.GET)
  public String home(Locale locale, Model model) {
      return "home_view";
  }
  </code></pre>
  
  <p><strong>views/home_view.vm</strong></p>
  
  <pre><code>&lt;h2&gt;Content title&lt;/h2&gt;
  &lt;p&gt;Content text&lt;/p&gt;
  </code></pre>
  
  <p><strong>views/template.vm</strong></p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;&lt;/title&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;!-- Header of page --&gt;
          #include({context variable which contains "home_view"} + ".vm");
          &lt;!-- Footer of page --&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><em>If anybody knows CakePHP, this is similar to its template system</em></p>
  
  <p>How can I do this?</p>