spring-mvctilesapache-tiles

How to define tiles definition for a specific view


So my tiles definition looks like following and I would like to know how I can manage it to show a specific template on a specific view: I want that the default template ist "commonPage" and for e.g. "/monitor1" return value I want the emptyTemplate to be applicated.

<tiles-definitions>
  <definition name="commonPage" template="/WEB-INF/tiles/layouts/topmenulayout.jsp">
    <put-attribute name="header" value="/WEB-INF/tiles/jsp/header.jsp" />
    <put-attribute name="menu" value="/WEB-INF/views/menu.jsp" />
    <put-attribute name="footer" value="/WEB-INF/tiles/jsp/footer.jsp" />
  </definition>

  <definition name="emptyPage" template="/WEB-INF/tiles/layouts/emptylayout.jsp">
  </definition>


  <!-- Views ending in "Dialog" have no header, menu or      -->
  <!-- footer. Useful for creating jQuery popup dialogs.     -->
  <definition name="*/*Dialog" template="/WEB-INF/views/{1}/{2}Dialog.jsp" />
  <definition name="*Dialog" template="/WEB-INF/views/{1}Dialog.jsp" />

  <!-- All other views get the header, menu and footer tiles. -->
  <!-- I want commonPage as default template, and e.g. for "/Monitor1" return value I want the emptyLayout       -->

  <definition name="*" extends="commonPage">
    <put-attribute name="body" value="/WEB-INF/views/{1}.jsp" />
  </definition>
</tiles-definitions>

Solution

  • It was pretty easy to solve it. I added the following definition and it worked the way I wanted it to be:

    <definition name="*Monitor1" extends="emptyPage">