You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tiles.apache.org by "Motley, Jeffery" <Je...@Williams.com> on 2010/08/03 21:09:59 UTC

tiles:putListAttribute question.

Hello,

 

I have the following tiles-defs.xml definition.

 

<definition name="soa.master" template="/layouts/soalayout.jsp">

             

          <put-list-attribute name="jscripts" cascade="true">

                <add-attribute value="/soa/js/hello.js" />

            </put-list-attribute>

          

                        

</definition>

 

 

I am using the following in my jsp file...

 

<tiles:insertDefinition name="soa.master">

 

<tiles:putListAttribute name="jscripts" cascade="true">

                <tiles:addAttribute value="/soa/js/hello2.js"
type="string"/>

 

 

</tiles:insertDefinition>

 

I am looping through the list to insert these js files into the head of
my page in another tile. 

 

<tiles:useAttribute id="jslist" name="jscripts"
classname="java.util.List" />

            <%   for(int i=0; i < jslist.size(); i++)  {

                  

                        org.apache.tiles.Attribute jsfile =
(org.apache.tiles.Attribute)jslist.get(i);

            %>

            <script type="text/javascript" src="<%=jsfile%>"></script>

            <% } %>

 

 

When I do this the putListAttribute in the jsp file gets used but the
one on the xml file is not in the list. (It seems to be replaced.) So
only hello2.js is used. Is there any way to include hello.js from the
xml file and add the hello2.js from the jsp? That way both are included,
the generic hello.js  from the xml plus the more specific hello2.js for
the jsp.

 

 

Thanks

Jeff


Re: tiles:putListAttribute question.

Posted by Antonio Petrelli <an...@gmail.com>.
2010/8/3 Motley, Jeffery <Je...@williams.com>:
> When I do this the putListAttribute in the jsp file gets used but the
> one on the xml file is not in the list. (It seems to be replaced.) So
> only hello2.js is used. Is there any way to include hello.js from the
> xml file and add the hello2.js from the jsp? That way both are included,
> the generic hello.js  from the xml plus the more specific hello2.js for
> the jsp.

Yes:
http://tiles.apache.org/framework/tutorial/advanced/list-attributes.html#List_attribute_inheritance
IOW, put inherit="true" in <tiles:putListAttribute>

HTH
Antonio