我使用Apache Tiles 2.1作爲我的模板框架(與Spring MVC一起)。Apache Tiles使用<put-attribute>設置html標記屬性值
我想知道如何最好地從我的瓷磚定義文件中設置HTML屬性值。例如,我有一個文本框,並希望能夠在我的定義中設置maxlength屬性。我希望下面的工作 - 使用這個定義
<input id="nameField" type="text"
maxlength="<tiles:insertAttribute name='maxlength' />" />
-
<definition name="sprint-goal" >
<put-attribute name="maxlength" value="100" />
</definition>
但似乎瓷磚忽略< insertAttribute/>標籤如果放在一個HTML標籤內。否則它工作正常。
注意:我已經嘗試使用ViewPreparer來設置請求範圍的值。這將工作,但不是我正在尋找。我想從Tiles定義中輕鬆設置HTML屬性值。