You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by Baptiste GAILLARD <ba...@gmail.com> on 2007/10/06 13:16:13 UTC
NoSuchDefinitionException when I try to display my page
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
Re: NoSuchDefinitionException when I try to display my page
Posted by Antonio Petrelli <an...@gmail.com>.
2007/10/8, Antonio Petrelli <an...@gmail.com>:
> 2007/10/7, Baptiste GAILLARD <ba...@gmail.com>:
> > But, I do not turn off validation on this file so I do not understand
> > why no errors where reported for this file.
>
>
> Mmm... this could be possibly a bug. I need to investigate.
> Thanks for the report :-)
It is a bug!
https://issues.apache.org/struts/browse/TILES-223
Thanks again
Antonio
Re: NoSuchDefinitionException when I try to display my page
Posted by Antonio Petrelli <an...@gmail.com>.
2007/10/7, Baptiste GAILLARD <ba...@gmail.com>:
>
> But, I do not turn off validation on this file so I do not understand
> why no errors where reported for this file.
Mmm... this could be possibly a bug. I need to investigate.
Thanks for the report :-)
Antonio
Re: NoSuchDefinitionException when I try to display my page
Posted by Baptiste GAILLARD <ba...@gmail.com>.
Antonio Petrelli a écrit :
> 2007/10/6, Baptiste GAILLARD <ba...@gmail.com>:
>
>> <?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>
>>
>
> Your tiles-defs.xml file is invalid, the root element must be
> "tiles-definitions".
> Anyway it's strange: did you turn off validation of the file?
>
> Antonio
>
>
Oh! Thank you, I've replaced "definitions" by "tiles-definitions" and it
works !
But, I do not turn off validation on this file so I do not understand
why no errors where reported for this file.
Baptiste.
Re: NoSuchDefinitionException when I try to display my page
Posted by Antonio Petrelli <an...@gmail.com>.
2007/10/6, Baptiste GAILLARD <ba...@gmail.com>:
> <?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>
Your tiles-defs.xml file is invalid, the root element must be
"tiles-definitions".
Anyway it's strange: did you turn off validation of the file?
Antonio