Search code examples
spring-mvctiles2

Tiles - Spring MVC


What is the difference between

<tiles:useAttribute ...>

and

<tiles:insertAttribute ...>

Can you give some example?


Solution

  • See http://tiles.apache.org/2.2/framework/tiles-jsp/tlddoc/tiles/insertAttribute.html and http://tiles.apache.org/2.2/framework/tiles-jsp/tlddoc/tiles/useAttribute.html.

    useAttribute declares a variable containing the attribute. insertAttribute inserts the attribute in the response. It's basically the same difference as there is between

    String id = attributeValue("theAttribute");
    

    and

    out.println(attributeValue("theAttribute"));