I have written the below code in tiles.xml file

<definition name="template" template="/WEB-INF/jsp/mainTemplate.jsp">
        <put-attribute name="title" value="Default title"/>
        <put-attribute name="header" expression="${requestScope.header}" />
        <put-attribute name="leftMenu" value="/WEB-INF/jsp/leftside.jsp"/>
        <put-attribute name="body" value=""/>
        <put-attribute name="filters" value="/WEB-INF/jsp/filters.jsp"/>
        <put-attribute name="footer" expression="${requestScope.footer)"/>
    </definition> 

When I ran the code I am getting the following error

"Attribute "expression" must be declared for element type "put-attribute".

I am using tile2.2.2

Please help to fix this issue

有帮助吗?

解决方案

Check the tiles DTD version in tiles.xml

Tiles 2.0 DTD doesn't support expression in put-attribute whereas Tiles 3.0 DTD supports that.

Change the tiles dtd version to tiles 3.0 and it will work.

Reference: http://tiles.apache.org/framework/tiles-core/dtddoc/tiles-config_3_0.dtd.html http://tiles.apache.org/2.1/framework/tiles-core/dtddoc/tiles-config_2_0.dtd.html

Thanks, Selva P

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top