I've just setup a new application with spring-mobile and apache-tiles that I intend to used tile descriptors to help me reuse view components among the target platforms. I'm wondering if anyone has already done this and the best way to structure the application. Working with tiles in the past the tile descriptors add up pretty quickly, adding mobile and tablet into the mix and I could have easily twice as many.
So far I have a master tiles definition WEB-INF/layout/tiles.xml
with three layouts in this area:
<tiles-definitions>
<definition name="layoutStandard" template="/WEB-INF/layout/standard.jsp"/>
<definition name="layoutMobile" template="/WEB-INF/layout/mobile.jsp"/>
<definition name="layoutTablet" template="/WEB-INF/layout/tablet.jsp"/>
</tiles-definitions>
And then view definitions.
<tiles-definitions>
<definition name="home" extends="layoutStandard">
<put-attribute name="body" value="/WEB-INF/views/home.jsp" />
</definition>
<definition name="home.mob" extends="layoutMobile">
<put-attribute name="body" value="/WEB-INF/views/home.mob.jsp" />
</definition>
<definition name="home.tab" extends="layoutTablet">
<put-attribute name="body" value="/WEB-INF/views/home.tab.jsp" />
</definition>
</tiles-definitions>
I've configured mobileSuffix
and tabletSuffix
against LiteDeviceDelegatingViewResolver
so there isn't much headache in my controller, which also has enableFallback
set which works well if I don't provide a mobile view definition.
Is there a way I can do something similar with the tiles configuration? i.e. if the view name ends in .mob
then use layoutMobile
instead of having to define it multiple times?