tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jorge Vasquez <jor...@mate1inc.com>
Subject Using tiles without the tiles xml definition
Date Mon, 07 Jun 2010 22:50:18 GMT
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"/>



Unfortunately, when it renders it is not replacing properly the elements 
in the template.  Any ideas?  Anyone has dealt with a similar situation 

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"]>
        <!-- TITLE -->
        <@tiles.insertAttribute name="title"/>
        <link rel=stylesheet type="text/css" href="style/style.css">
    <!-- 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" 
            <tr valign="top">
                <td width="780">
                    <!-- LOGO -->
                    <img src="<@tiles.insertAttribute name="logo"/>" 
width="780" height="143" border="0" alt="">
        <table width="100%" cellpadding="0" cellspacing="0" border="0">
            <td width="510">
                <table width="510" cellpadding="5" cellspacing="5" 
                    <tr valign="top">
                        <td width="510">
                            <!-- BODY -->
                            <@tiles.insertAttribute name="body" />
                    <tr valign="top">
                        <td width="510">
                            <!-- FOOTER -->
                            <@tiles.insertAttribute name="footer" />

Jorge Vasquez

View raw message