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/15 18:16:03 UTC

How can I separate tiles.xml in several files ?

I begin to have a lot of tiles definitions in my WEB-INF/tiles.xml file, 
is it possible to separate this files in multiple files ?


Re: How can I separate tiles.xml in several files ?

Posted by Antonio Petrelli <an...@gmail.com>.
2007/10/16, Baptiste GAILLARD <ba...@gmail.com>:
>
> So I suppose I can't extend a definition which is defined in another
> tiles.xml file ?



Try to declare them in the "correct" order, i.e. firstly the one that
contains the "base" definition (in your case "datatable", contained in
/pages/components/datatable/tiles.xml) and then the one that contains the
extended definition (userDatatable, contained in WEB-INF/tiles.xml).


Is it possible to do that in tiles 2, is there an "include" makup like
> in struts config files ?



No :-( but it seems like a not-so-bad idea, so please feel free to discuss
it in the Tiles Developers mailing list:
http://tiles.apache.org/mail-lists.html
or file a JIRA issue.

Antonio

Re: How can I separate tiles.xml in several files ?

Posted by Baptiste GAILLARD <ba...@gmail.com>.
Antonio Petrelli a écrit :
> 2007/10/15, Baptiste GAILLARD <ba...@gmail.com>:
>   
>> I begin to have a lot of tiles definitions in my WEB-INF/tiles.xml file,
>> is it possible to separate this files in multiple files ?
>>     
>
> Sure, as long as you specify them in the correct configuration parameter:
> http://tiles.apache.org/config-reference.html#org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG
>
> Antonio
>
>   
Ok, it seems to work, but now I want to define a definition which 
extends a definition specified in an other tiles.xml file.

In /WEB-INF/tiles.xml I have

<definition name="userDatatable" extends="datatable">
    <put-list-attribute name="attributesTiles">
        <item link="login" value="login" />
        <item link="firstName" value="first name" />
        <item link="lastName" value="last name" />
    </put-list-attribute>
</definition>

In /pages/components/datatable/tiles.xml I have :

<definition name="datatable" 
template="/pages/components/datatable/datatable.jsp">
    <put-list-attribute name="resultsByPageTiles">
        <add-attribute value="10" />
        <add-attribute value="25" />
        <add-attribute value="50" />
        <add-attribute value="100" />
        <add-attribute value="all" />
    </put-list-attribute>
</definition>

The following errors appears when I access to my page:
01:13:07,470 ERROR [DefinitionsImpl] Error while resolving definition 
inheritance: child 'userDatatable' can't find its ancestor 'datatable'. 
Please check your description file.
01:13:07,470 ERROR [RoleSecurityTagSupport] Error executing tag: Error 
while resolving definition inheritance: child 'userDatatable' can't find 
its ancestor 'datatable'. Please check your description file.
org.apache.tiles.definition.NoSuchDefinitionException: Error while 
resolving definition inheritance: child 'userDatatable' can't find its 
ancestor 'datatable'. Please check your description file.

So I suppose I can't extend a definition which is defined in another 
tiles.xml file ?
Is it possible to do that in tiles 2, is there an "include" makup like 
in struts config files ?

Thanks.

Baptiste


Re: How can I separate tiles.xml in several files ?

Posted by Antonio Petrelli <an...@gmail.com>.
2007/10/15, Baptiste GAILLARD <ba...@gmail.com>:
> I begin to have a lot of tiles definitions in my WEB-INF/tiles.xml file,
> is it possible to separate this files in multiple files ?

Sure, as long as you specify them in the correct configuration parameter:
http://tiles.apache.org/config-reference.html#org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG

Antonio