tags:

views:

73

answers:

0

I am using Apache Tiles 2.1 as my templating framework (along with Spring MVC).

I want to know how best to be able to set HTML attribute values from within my Tiles definitions file. For example I have a text box and want to be able to set the maxlength attribute from within my definition. I expected the following to work -

<input id="nameField" type="text"
    maxlength="<tiles:insertAttribute name='maxlength' />" />

using this definition -

<definition name="sprint-goal" >
       <put-attribute name="maxlength" value="100" />
</definition>

But it seems that Tiles ignores the <insertAttribute/> tag if placed within a HTML tag. It works fine otherwise.

Note: I have tried using a ViewPreparer to set request-scoped values. This will work but is not exactly what I am looking for. I would like to easily set HTML attribute values from within a Tiles definition.