Dear guys,

I searched the archive and the Usenet without success.

I'm using a box with:

 - Linux Red Hat 7.2
 - Apache 1.3.20
 - mod_jk (ajp13)
 - Tomcat 3.3

I developed a web application that let you browse through some static HTML
pages and let you update the content of these HTML page, inserting some data
in a form.

The update of the static pages is done by a servlet that rewrite the HTML
file. The problem is that I can't get the last updated HTML page in my
browser.

I thought it was a problem realted to caching, so I forced Apache to set the
"Expires" header writing in the httpd.conf:

#ExpiresActive On
#ExpiresByType text/html "access"

but this solution didn't help.

I turned on a protocol analyzer (Etheral) to try and understand what the
problem was and I realized that Apache does not set the "Expires" header
when the HTML page comes from Tomcat.

I think my application is not so strange: I want to save the new data
inserted by the user so that the next time she requests the page she gets
the last version of it.

I wrote another very simple application to explain my problem better, simply
copy the following files under $TOMCAT_HOME/webapps/ and compile the
servlet:

===============
test/index.html
===============
<html>
<head>
</head>
<body>
<a href="servlet/DateServlet">Test</a><br>
</body>
</html>

=====================================
test/WEB-INF/classes/DateServlet.java
=====================================
import java.io.*;
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class DateServlet extends HttpServlet {
        
        public void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException, ServletException {
                try {
                        Date now = new Date();
                        
                        PrintWriter dateWriter = new PrintWriter(new
FileWriter("../webapps/test/date.html"), true);
                        dateWriter.println(now);
                        dateWriter.println("<br>");
                        dateWriter.println("<a
href=\"servlet/DateServlet\">Update</a>");
                        dateWriter.close();
                        
                        response.setContentType("text/html");
                        PrintWriter out = response.getWriter();
                        out.println(now);
                        out.println("<meta http-equiv='refresh' content='3;
url=\"/test/date.html\"'></meta>");
                        
                } catch(Exception ex) {
                        PrintWriter errorWriter = new PrintWriter(new
FileWriter("../webapps/bib/error.txt"), true);
                        ex.printStackTrace(errorWriter);
                        errorWriter.close();
                }
        }
        
}

Did anyone else experiment such problems?

Cheers,
Michele

--
To unsubscribe:   <mailto:[EMAIL PROTECTED]>
For additional commands: <mailto:[EMAIL PROTECTED]>
Troubles with the list: <mailto:[EMAIL PROTECTED]>

Reply via email to