You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Patrick Casey <pa...@adelphia.net> on 2005/11/01 21:28:57 UTC

Tip of the Day (because I just figured this out myself)

 

            I'm working on an app now that I've developed almost entirely
inside of firefox, and I'm finally at that point now where I'm testing it on
IE. Unsurpringly, lots of stuff didn't work. One of those was that my
efforts to disable browser caching, which worked perfectly in FireFox,
didn't work at all in IE. Hence, bad things were happening.

 

            What I was doing (that didn't work) was something like this in
my border class:

 

            <span jwcid="@Shell" stylesheet="ognl:assets.stylesheet"
title="Demo Application" />

                        <html>

                                    <META HTTP-EQUIV="CACHE-CONTROL"
CONTENT="NO-CACHE">

<META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">

                        </html>

                        <span jwcid="@RenderBody" />

            </span>

 

            Which actually resulted in two different <html> headers per
page, but firefox gamely worked through that. Not IE though.

            

            It turns out though that tapestry provides a much better
solution to the issue of adding additional meta tags to all your pages. You
do it with a rendering delegate inside of your shell.

 

            So instead you do:

 

<span jwcid="@Shell" stylesheet="ognl:assets.stylesheet" title="Demo
Application" delegate="ognl:beans.BorderDelegate"/>

 

            And then define your delegate something like this:

 

package components;

 

import org.apache.tapestry.IMarkupWriter;

import org.apache.tapestry.IRender;

import org.apache.tapestry.IRequestCycle;

 

public class BorderDelegate implements IRender{

 

            public void render(IMarkupWriter writer, IRequestCycle cycle) {

                        writer.printRaw("<META HTTP-EQUIV=\"CACHE-CONTROL\"
CONTENT=\"NO-CACHE\">");

                        writer.printRaw("<META HTTP-EQUIV=\"PRAGMA\"
CONTENT=\"NO-CACHE\">");

                        

            }

 

}

            And voila, you are getting your META tags into the border's
<html> span.

 

            Amazing that I've gotten this far in Tapestry without figuring
out that little trick.

 

            --- Pat