title: Select Spring MVC layout based on URL
body: <p>I'm looking for a way to dynamically load layouts based on some value set in some bean.
  Using Spring MVC with apache tiles.</p>
  
  <p>Inside my views.xml I would typically have something like:</p>
  
  <pre><code>&lt;definition extends="mytemplate" name="home"&gt;
      &lt;put-attribute name="title" value="Home Page Title"/&gt;
      &lt;put-attribute name="heading" value="Home"/&gt;
      &lt;put-attribute name="body" value="/WEB-INF/pages/home.jspx"/&gt; 
      &lt;put-attribute name="side" value="/WEB-INF/pages/side.jspx"/&gt; 
  &lt;/definition&gt;
  </code></pre>
  
  <p>and then inside mytemplate.jspx there would be code defining what the template looks like.</p>
  
  <p>What I'm looking for is a way to change the mytemplate depending on some URL logic (check if incoming url is www.example1.com or www.example2.com), intercepting the url via RequestInterceptor, setting a value in a ThemeLayoutBean and then based on whether it is url1 or url2, have mytemplate1 and mytemplate2, each one having a completely different layout.</p>