I'm looking for a way to dynamically load layouts based on some value set in some bean. Using Spring MVC with apache tiles.
Inside my views.xml I would typically have something like:
<definition extends="mytemplate" name="home">
<put-attribute name="title" value="Home Page Title"/>
<put-attribute name="heading" value="Home"/>
<put-attribute name="body" value="/WEB-INF/pages/home.jspx"/>
<put-attribute name="side" value="/WEB-INF/pages/side.jspx"/>
</definition>
and then inside mytemplate.jspx there would be code defining what the template looks like.
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.