Hello everyone,
I'm starting to use tiles+freemarker for my project. I am trying to
figure out a way to not have to use the tiles.xml file as I think it's
simpler for everyone in my team if we just deal with pages and each page
includes the template that it is referencing. I am using Struts2 with
tiles 2.06.
The page that I am trying to render (a simple login page) has the following:
<#assign tiles=JspTaglibs["http://tiles.apache.org/tags-tiles"]>
<@tiles.insertTemplate template="/WEB-INF/ftl/layouts/blank_layout.ftl">
<@tiles.putAttribute name="title" value="My Admin Login" />
<@tiles.putAttribute name="body_background"
value="images/background_paper.jpg" />
<@tiles.putAttribute name="logo" value="images/my_logo_default.jpg" />
<@tiles.putAttribute name="footer"
value="/WEB-INF/ftl/tiles/footer.ftl" />
<@tiles.putAttribute name="body" >
<h2>eDate Admin Login:</h2>
<@s.form action="login">
<@s.textfield label="Email" name="email"/>
<@s.password label="Password" name="password"/>
<@s.submit/>
</@s.form>
</@tiles.putAttribute>
</@tiles.insertTemplate>
Unfortunately, when it renders it is not replacing properly the elements
in the template. Any ideas? Anyone has dealt with a similar situation
before?
In case it helps this is my template (blank_layout.ftl):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<#assign tiles=JspTaglibs["http://tiles.apache.org/tags-tiles"]>
<html>
<head>
<@s.head/>
<!-- TITLE -->
<@tiles.insertAttribute name="title"/>
<link rel=stylesheet type="text/css" href="style/style.css">
</head>
<!-- BODY BACKGROUND -->
<body bottommargin="0" leftmargin="0" marginheight="0"
marginwidth="0" rightmargin="0" topmargin="0"
background=<@tiles.insertAttribute name="body_background"/> >
<table width="780" height="143" cellpadding="0" cellspacing="0"
border="0">
<tr valign="top">
<td width="780">
<!-- LOGO -->
<img src="<@tiles.insertAttribute name="logo"/>"
width="780" height="143" border="0" alt="">
</td>
</tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<td width="510">
<table width="510" cellpadding="5" cellspacing="5"
border="0">
<tr valign="top">
<td width="510">
<!-- BODY -->
<@tiles.insertAttribute name="body" />
</td>
</tr>
<tr valign="top">
<td width="510">
<!-- FOOTER -->
<@tiles.insertAttribute name="footer" />
</td>
</tr>
</table>
</td>
</table>
</body>
</html>
Thanks,
Jorge Vasquez