[ 
https://issues.apache.org/struts/browse/TILES-337?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Antonio Petrelli resolved TILES-337.
------------------------------------

    Resolution: Won't Fix

Things put in <tiles:putAttribute> tag are evaluated in the page where they are 
defined, not in the page in which they are included.
This is how JSP pages work.
The workaround is using the <%include> directive (not the <jsp:include> tag).

> putAttribute does not render inline dynamic content (jsp) correctly
> -------------------------------------------------------------------
>
>                 Key: TILES-337
>                 URL: https://issues.apache.org/struts/browse/TILES-337
>             Project: Tiles
>          Issue Type: Bug
>    Affects Versions: 2.1.1
>         Environment: OS: windows xp
> JRE    1.5.0_11-b03
> Tomcat 5.5.26
> Struts 2.0.11.2
> Tiles  2.1.0
>            Reporter: ken van eyk
>
> Placing dynamic in-line dyanmic content with the "putAttribute" tag does not 
> render correctly.
> JRE    1.5.0_11-b03
> Tomcat 5.5.26
> Struts 2.0.11.2
> Tiles  2.1.0
> Sample Files:  (NOTE: have not included taglib definitions here)
> tiles.xml
> ---------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE tiles-definitions PUBLIC
>        "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN"
>        "http://tiles.apache.org/dtds/tiles-config_2_1.dtd";
> >
> <tiles-definitions>
>     <definition name="layout" template="/layout/layout.jsp" />
> </tiles-definitions>
> /layout/layout.jsp
> ---------------------
> <html>
>       <body>
>               <tiles:insertAttribute name="content" />
>       </body>
> </html>
> /include/include.jsp
> ---------------------
> <hr/>
>   include.jsp: param.foo=${param.foo}
> </hr>
> /jsp1.jsp
> ---------------------
> <hr/>
>   jsp1.jsp: param.foo=${param.foo}
> </hr>
> <tiles:insertDefinition name="layout" >
>       <tiles:putAttribute name="content" cascade="true" 
> value="/include/include.jsp" />
> </tiles:insertDefinition>
> /jsp2.jsp
> ---------------------
> <hr/>
>   jsp2.jsp: param.foo=${param.foo}
> </hr>
> <tiles:insertDefinition name="layout" >
>       <tiles:putAttribute name="content" cascade="true">
>               <jsp:include page="/include/include.jsp" />
>       </tiles:putAttribute>
> </tiles:insertDefinition>
> /jsp3.jsp
> ---------------------
> <hr/>
>   jsp3.jsp: param.foo=${param.foo}
> </hr>
> <tiles:insertDefinition name="layout" >
>       <tiles:putAttribute name="content" cascade="true">
>               <hr/>
>                 INLINE putAttribute: param.foo=${param.foo}
>               </hr>           
>       </tiles:putAttribute>
> </tiles:insertDefinition>
> Use case: Post to jsp1 a couple of times with different http param values for 
> the parameter 'foo'.  Then do the same for jsp2 and jsp3.
> Results:
> - jsp1.jsp renders correctly
> - jsp2.jsp renders correctly
> - jsp3.jsp renders incorrectly after the second or third request. Subsequent 
> posts result in the second param.foo value being stale (keeps a value from an 
> earlier http post) and not matching the first param.foo value.
> I would like to in-line jsp inside the putAttribute start/end tags but it 
> seems to only handle dynamic content for a request or two.  Is this a bug or 
> is in-line dynamic content not supported?  It would be a shame to have to add 
> an extra include file for every attribute with dynamic content.
> I have also tried substituting the jstl el expression in jsp3 with 
> <%=request.getParameter( "foo" ) %> as well as trying various values for the 
> putAttribute "type" attribute and got the same results.
> Thanks for all the help,
> Ken

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to