title: Spring 4: Individual view layouts depending on request
body: <p>I am using Spring 4 MVC to display serve my web page. I now want to display the <strong>same content</strong> with <strong>different layouts</strong> wrapped around the body/content depending on the current HttpServletRequest (e.g. <code>request.getServerName()</code>). This means <strong><a href="https://page1.test/page.html" rel="nofollow">https://page1.test/page.html</a></strong> will be mapped to the same controller as <strong><a href="https://page2.test/page.html" rel="nofollow">https://page2.test/page.html</a></strong> and returns the same content depending on the controller logic, but <strong>page1.test</strong> draws for example a different header and footer.</p>
  
  <p>As far as I know, Spring MVC is not capable of doing this. I am now planing to use Apache Tiles 3 or JSP 2.0 tags to do this. Is there any best practice and how can I do this (Spring Java Config is preferred)?</p>