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