1

I have a question regarding the behaviour of Tapestry (Version 5.3): I have a 'web application' (local server with tomcat6, no http://) with multiple pages that connects to a MySQL database. A <t:form> with <t:submit> will send a search query to the database which will then return a page where the content containing the search parameter is printed via <t:outputraw> to the .tml page. On reloading the page or going back and searching for the same parameter (e.g. String) again causes the page not to show any non-static content (String content not staticly written into the .tml) anymore. I already tried different reloading methods, but its always the same blank output.

Code:

the page containing the output prints it like this:

<p style="line-spacing: 12px">
        <t:loop source="List" value="StringEntry">
            <t:if test="continuecondition">
                <t:outputraw value="FoundString" />
                <br />
            </t:if> 
        </t:loop>
    </p>

also I tried to check on which part the problem occurs

<p>
      <b>${listSize} </b>  <br/>
      <b>${printedLineCount}</b> 
  </p>

listSize contains the query result after the search, printedLineCount is equal to the number of continueCondition was true (number of printed lines on the page).

When the problem occurs, the Java list is as big as it should be, whereas the other value is zero, thus not showing any output on the page. My question is now, why does it print the content only once (pagecreation) and not everytime the page is (re)loaded? Has it something to do with the browser/server cache? If yes, is there anthing I could do to throw away the cache and reload it that way, that it is shown again? Or if not, is there something I could do to maybe destroy the PageLink and recreate it if already existing?

Thanks in advance, Kind regards

Side note: Restarting the Browser solves the problem. (on the first search everything is fine, but if you reload the page or search the same query again, the error is the same)

MIP
  • 29
  • 5

1 Answers1

0

The Response object gives you a way to set (overwrite) headers ; these headers have to request the browser not to cache the page.

Typical headers are

@Inject
private Response response;
...
response.setDateHeader("Expires", 0);
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
response.setHeader("Cache-Control", "post-check=0, pre-check=0");
response.setHeader("Pragma", "no-cache");

Headers may be sent from any framework, here is more information about "no caching" headers.

Community
  • 1
  • 1
Déjà vu
  • 28,223
  • 6
  • 72
  • 100
  • Thanks for your answer, seems like what I was searching for! But I have another question: As I'm using a local server with tomcat6 to host the web application, does that change anything to altering the header? And where do I have to put it? (e.g. new class, include into AppModule, include into PageLayout, etc.). Thanks again – MIP Feb 03 '16 at 10:32