tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jorge Vasquez <jor...@mate1inc.com>
Subject Re: Using tiles without the tiles xml definition
Date Tue, 08 Jun 2010 16:07:56 GMT
Antonio Petrelli wrote:
> 2010/6/8 Jorge Vasquez <jorgev@mate1inc.com>:
>> Antonio Petrelli wrote:
>> The main problem is that the tiles.insertAttribute tags are not being
>> replaced by whatever I try to set using the tiles.putAttribute tags.
>> This is why I am getting in the browser:
>> ....
>>                <@s.head/>
>>                <!-- TITLE -->
>>                <@tiles.insertAttribute name="title"/>
> I see that not only Tiles tags are not evaluated, but also Struts ones
> have problems.
> It seems that your templates are passing unmodified. Are you sure you
> are using FreemarkerServlet correctly?
> If yes, I suppose that you need to contact the Freemarker team.
> Antonio
Everything works fine in this project if I use the normal approach of 
the tiles.xml file with all the definitions, but I am trying to use a 
more basic approach involving just ftl pages, no tiles xml file.

I just upgraded all of my tiles jars to 2.2.1.

I am using Tiles and Struts2. 

These are the jars from tiles that I included into the WEB-INF/lib:  
tiles-api-2.2.1.jar, tiles-core-2.2.1.jar, tiles-freemarker-2.2.1.jar, 
tiles-servlet-2.2.1.jar, tiles-template-2.2.1.jar.

This is the portion of my web.xml file that is relevant to the tiles 


In my struts.xml file I have:

            <result-type name="freemarker" 
            <result-type name="tiles" 

Now, since I upgraded to 2.2.1 I am getting the following error:

<pre> Expression tiles is undefined on line 1, column 3 in 
WEB-INF/ftl/tiles/login/login.ftl. The problematic instruction: 
---------- ==&gt; user-directive tiles.insertTemplate [on line 1, column 
1 in WEB-INF/ftl/tiles/login/login.ftl] </pre>
<pre>freemarker.core.InvalidReferenceException: Expression tiles is 
undefined on line 1, column 3 in WEB-INF/ftl/tiles/login/login.ftl. </pre>

This is my login.ftl code:

<@tiles.insertTemplate template="/WEB-INF/ftl/layouts/blank_layout.ftl">

  <@tiles.putAttribute name="title"  value="eDate Admin Login" />
  <@tiles.putAttribute name="body_background" 
value="images/background_paper.jpg" />
  <@tiles.putAttribute name="logo" value="images/mate1_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"/>



This is the mapping in my struts.xml file:

        <action name="login_*" method="{1}" 
            <interceptor-ref name="eDateAdminBaseStack"/>
            <result name="success" type="redirectAction">mainmenu</result>
            <result name="error" type="tiles">error_page</result>
            <result name="input" 

What am I missing?, why isn't it recognizing the tiles tags?  Any 
references on integrating Struts2 + Tiles2 + FreeMarker?

Thanks again,
Jorge Vasquez

View raw message