Apache tiles insertAttribute ignore attribute
February 13, 2012 20:48:56 Last update: February 13, 2012 20:48:56
When you insert an attribute in JSP:
you must define the attribute in tiles definitions:
Otherwise you'll get runtime exception.
The
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%> <tiles:insertAttribute name="body"/>
you must define the attribute in tiles definitions:
<definition name="/home" template="/WEB-INF/templates/main.jsp"> <put-attribute name="body" value="/WEB-INF/views/home-body.jsp" /> </definition>
Otherwise you'll get runtime exception.
The
ignore attribute, which defaults to false, will suppress the runtime exception when the attribute is not defined in tiles definition:
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%> <tiles:insertAttribute name="body" ignore="true"/>