Propagating a Tiles attribute down the include chain

前端 未结 2 928
梦如初夏
梦如初夏 2021-02-07 09:38

I\'m using Tiles and I\'d like an attribute defined for a page to be readable inside of one of the included subpages as follows:

tiles-definitions.xml:

相关标签:
2条回答
  • 2021-02-07 10:11

    To propagate the title attribute to inner templates you need to add cascade="true" attribute to the title's <put-attribute> tag, like this:

    <definition name="tutorial" extends="page">
      <put-attribute name="title" cascade="true" value="Tutorial"/>
      <put-attribute name="body" value="/WEB-INF/jsp/tutorial.jsp"/>
    </definition>
    
    0 讨论(0)
  • 2021-02-07 10:13

    Take care to upgrade the Tiles definition file to 2.1 min, as cascade is available since 2.1.

    <!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN" "http://tiles.apache.org/dtds/tiles-config_2_1.dtd">
    

    0 讨论(0)
提交回复
热议问题