Hi, i'm trying to use Tiles with a very simple sample, here is my
configuration :
--- --- --- File WEB-INF/web.xml --- --- ---
...
...
<!-- Tiles configuration -->
<servlet>
<servlet-name>tiles</servlet-name>
<servlet-class>org.apache.tiles.web.startup.TilesServlet</servlet-class>
<init-param>
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
<param-value>/WEB-INF/tiles-defs.xml</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
...
...
--- --- --- File WEB-INF/tiles-defs.xml --- --- ---
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<definition name="homepage" template="/index2.jsp">
<put-attribute name="header" value="/header.jsp" />
<put-attribute name="leftmenu" value="/leftmenu.jsp" />
<put-attribute name="centerarea" value="/centerarea.jsp" />
<put-attribute name="rightmenu" value="/rightmenu.jsp" />
<put-attribute name="footer" value="/footer.jsp" />
</definition>
--- --- --- File index.jsp --- --- ---
<?xml version="1.0" encoding="UTF-8" ?>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<tiles:insertDefinition name="homepage" />
When I try to acces the index.jsp page JBoss AS display me those errors :
...
...
12:55:17,212 INFO [BasicTilesContainer] Initializing Tiles2 container. . .
12:55:17,248 INFO [BasicTilesContainer] Tiles2 container initialization
complete.
12:55:17,249 INFO [TilesAccess] Publishing TilesContext for context:
org.apache.tiles.web.util.ServletContextAdapter
12:55:30,266 WARN [BasicTilesContainer] Unable to find the definition
'homepage'
12:55:30,266 ERROR [RoleSecurityTagSupport] Error executing tag: homepage
org.apache.tiles.definition.NoSuchDefinitionException: homepage
at
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:392)
at
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:368)
at
org.apache.tiles.jsp.taglib.InsertDefinitionTag.render(InsertDefinitionTag.java:63)
...
...
If I delete everything in the file tiles-defs.xml and put those lines in
index.jsp it works :
<tiles:insertTemplate template="/index2.jsp">
<tiles:putAttribute name="header" value="/header.jsp" />
<tiles:putAttribute name="leftmenu" value="/leftmenu.jsp" />
<tiles:putAttribute name="centerarea" value="/centerarea.jsp" />
<tiles:putAttribute name="rightmenu" value="/rightmenu.jsp" />
<tiles:putAttribute name="footer" value="/footer.jsp" />
</tiles:insertTemplate>
So why a NoSuchDefinitionException appears when I'm using a tiles's
definition ?
Thanks,
Baptiste GAILLARD