struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aladin Alaily <str...@aladin.ca>
Subject Re: Doofus tiles question - problem nesting
Date Sat, 15 Apr 2006 16:29:18 GMT
Rick Reumann wrote:

> I know I'm doing something stupid here, but would appreciate the help. 
> All I want to do is be able to insert dynamic content (like for example 
> a submenu list of links) into my header.jsp that is part to my 
> mainLayout.jsp.
> 
> What I have been trying is (html stripped out)...
> 
> <tiles-definitions>
>     <definition name="main.layout" path="/mainLayout.jsp">
>         <put name="header" value="/header.jsp"/>
>     </definition>
>     <definition name="search.tile" extends="main.layout">
>         <put name="page_links" value="/searchLinksTile.jsp"/>
>     </definition>
>     <definition name="basic.search.page" extends="search.tile">
>         <put name="page_title" value="Basic Search" type="string"/>
>         <put name="content" value="/WEB-INF/jsp/basicSearch.jsp"/>
>     </definition>
> </tiles-definitions>
> 
> 
> mainLayout...
> ----------
> 
> <tiles:insert attribute="header">
>     <tiles:put name="links" content="page_links"/> ??? I'm probably 
> doing this wrong
> </tiles:insert>
> 
> <tiles:insert attribute="content"/>
> 
> 
> 
> header.jsp
> ----------
> //HTML stuff then,
> <tiles:insert attribute="links"/>
> 
> 
> All of the header html is displaying fine in the mainLayout jsp, other 
> than 'links' stuff (searchLinksTile.jsp) that I'm trying to add. I've 
> been trying things different ways to get this searchLinksTile.jsp to be 
>  picked up in the header section, but I'm not having much luck.
> 
> I know what I want can be done, so I must be just screwing up something 
> simple.
> 
> Thanks for any help.
> 

Try the following:

tiles-defs.xml
===============
<tiles-definitions>
   ...
   <definition name="main.layout" path="/mainLayout.jsp">
     <put name="header" value="/header.jsp"/>
     <put name="page_links" value="" />
   </definition>
   ...
   <definition name="search.tile" extends="main.layout">
     <put name="page_links" value="/searchLinksTile.jsp"/>
   </definition>
   ...
</tiles-definitions>

Main Layout.jsp
================

<tiles:useAttribute name="page_links" id="page_links" 
classname="java.lang.String" />

... in your html on the page ...

<%= page_links %>


Maybe I'm missing your point but I hope this helps.
Aladin



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message