struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Petrelli <apetre...@apache.org>
Subject Re: [Tiles] Defining insert points in derived definitions
Date Tue, 05 Dec 2006 15:35:48 GMT
See inline comments...

Jean-Baptiste Lièvremont ha scritto:
> * File: /WEB-INF/tiles-defs.xml
>
> <tiles-definitions>
>
>  <definition name="standard" path="/WEB-INF/tiles/standard.jsp">
>    <put name="jsphead"  content="/WEB-INF/tiles/standard/jsphead.jsp"/>
>    <put name="htmlhead" content="/WEB-INF/tiles/standard/htmlhead.jsp"/>
>    <put name="title"    content="/WEB-INF/tiles/standard/title.jsp"/>
>    <put name="content"  content="/WEB-INF/tiles/standard/content.jsp"/>
>    <put name="footer"   content="/WEB-INF/tiles/standard/footer.jsp"/>
>  </definition>
>
>  <definition name="default" extends="standard">
>    <put name="content" content="/WEB-INF/tiles/default/content.jsp"/>
>  </definition>
>
>  <!-- Other definitions extending standard... -->
>
> </tiles-definition>
> ....
>
> File: /WEB-INF/tiles/multiPane/content.jsp
>
> <?xml version="1.0" encoding="UTF-8"?>
> <jsp:root version="1.2"
>  xmlns="http://www.w3.org/1999/xhtml"
>  xmlns:jsp="http://java.sun.com/JSP/Page"
>  xmlns:html="/tags/struts-html"
>  xmlns:tiles="/tags/struts-tiles"
>  xmlns:logic="/tags/struts-logic"
>  xmlns:bean="/tags/struts-bean">
>
> <html:xhtml/>
>
> <div id="content">
>
>  <tiles:useAttribute name="pgList" id="pgList" 
> classname="java.util.List"/>
>
>  <logic:iterate name="pgList" id="pg">
>    <tiles:insert flush="false">
>      <jsp:attribute name="page"><bean:write name="pg"/></jsp:attribute>
>    </tiles:insert>
>  </logic:iterate>
>
> </div>
>
> </jsp:root>


The problems is that you want to read attributes inside non-layout 
pages. In your case your layout page is "standard.jsp" and you can read 
attributes (i.e. using <tiles:insert attribute....>, 
<tiles:useAttribute>, <tiles:importAttribute>) only in that page.
To solve your problem, use <tiles:importAttribute> to import your 
attribute in request scope in "standard.jsp":
<tiles:importAttribute name="pgList" scope="request">
Then use it as a normal request-scoped bean.

HTH
Antonio

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


Mime
View raw message