Attribute not found:NoSuchAttributeException in tiles with Spring

≡放荡痞女 提交于 2019-12-02 07:00:23

I found the answer after few changes in the tiles.xml

The main problem with it is that you can not use the definition directly. You have to extend it and then you can use it.

Refer this my edited code:

<definition name="new.definition" template="/WEB-INF/layout/newlayout.jsp"> 
<put-attribute name="title" value="" /> 
<put-attribute name="body" value="" /> 
<put-attribute name="menu" value="" /> 
</definition> 

<definition name="choice" extends="new.definition"> 
<put-attribute name="title" value="" /> 
<put-attribute name="body" value="/WEB-INF/views/choice.jsp" /> 
<put-attribute name="menu" value="" /> 
<put-attribute name="right" value="" /> 
    </definition> 

<definition name="logout" extends="new.definition"> 
<put-attribute name="title" value="Logging out.." />
 <put-attribute name="body" value="/WEB-INF/views/logout.jsp" />
 <put-attribute name="menu" value="" /> 
<put-attribute name="right" value="" /> 
</definition> 

As you can see, I initially created new definition as "new.definition" and then for choice and logout I am extending the existing definition.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!