【问题标题】:How to define tiles definition for a specific view如何为特定视图定义切片定义
【发布时间】:2017-11-15 07:31:14
【问题描述】:

所以我的图块定义如下所示,我想知道如何管理它以在特定视图上显示特定模板: 我希望默认模板是“commonPage”,例如“/monitor1”返回值我想应用emptyTemplate。

<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>

【问题讨论】:

    标签: spring-mvc tiles apache-tiles


    【解决方案1】:

    解决它很容易。 我添加了以下定义,它按照我想要的方式工作:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-05-27
      • 1970-01-01
      • 2023-03-16
      • 2020-06-01
      • 1970-01-01
      • 2015-05-26
      • 1970-01-01
      相关资源
      最近更新 更多