tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Bowen <kbo...@als.com>
Subject Re: How to make Java variables accessible across Tiles attribute
Date Sun, 26 Oct 2008 13:33:45 GMT
This looks like it would better to ask on the Tiles mailing list:  http://tiles.apache.org/mail.html

  (bottom of page to subscribe).

On Oct 25, 2008, at 6:15 AM, Steven Lee wrote:

> I am converting a web-based application to use Tiles.  The  
> application has Java code embedded in the JSP pages.  The general  
> template is something like the following which I've simplified:
>
> <html>
> <head>
> <tiles:insertAttribute name="head" />
> </head>
> <body>
> <tiles:insertAttribute name="content" />
> </body>
> </html>
>
>
> Here is a sample JSP.
>
> <tiles:insertTemplate template="/layouts/main.jsp" flush="true">
> <tiles:putAttribute name="head" type="string">
> <%
>   String tmp = "JSP Test";
> %>
> </tiles:putAttribute>
>
> <tiles:putAttribute name="content" type="string">
> <p><%= tmp %></p>
> </tiles:putAttribute>
> </tiles:insertTemplate>
>
>
> This won't compile because the Tile attribute 'content' doesn't have  
> access to the 'tmp' variable defined in another Tiles attribute.   
> Looking at the generated Java code, the output of each Tile  
> attribute is within a do { } construct.  Is there a way to make all  
> Java variables accessible within the JSP page as I had before using  
> Tiles?
>
> -Steven
>


Mime
View raw message