Found the answer to my own question. Just need to give the browser some hints that it should cache the page. Something like:
- staticJavascript.jsp: <%@ page language="java" contentType="application/x-javascript" %> <%@ taglib uri = "http://struts.apache.org/tags-html-el" prefix = "html"%> <% response.setHeader("Cache-Control", "max-age=3600");%> <html:javascript scriptLanguage="true" dynamicJavascript="false" staticJavascript="true"/> Aymeric. -----Original Message----- From: Aymeric Alibert [mailto:[EMAIL PROTECTED] Sent: Monday, June 27, 2005 5:29 AM To: 'Struts Users Mailing List' Subject: caching staticJavascript.jsp? I am building a Struts (1.2.7) application that client will access using a slow connection (56K modem) and I am trying to limit the amount of data downloaded from the server. Since I am using the Validator, I would like to create an external staticJavascript.jsp page that could be cached by the browser to hold the javascript generated by the Validator. Here is what I have: - staticJavascript.jsp: <%@ page language="java" contentType="application/x-javascript" %> <%@ taglib uri = "http://struts.apache.org/tags-html-el" prefix = "html"%> <html:javascript scriptLanguage="true" dynamicJavascript="false" staticJavascript="true"/> - agencies.jsp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <%@ page contentType = "text/html;charset=UTF-8" language = "java"%> <%@ taglib uri = "http://struts.apache.org/tags-html-el" prefix = "html"%> <%@ taglib uri = "http://java.sun.com/jstl/core_rt" prefix = "c"%> <%@ taglib uri = "http://java.sun.com/jstl/fmt_rt" prefix = "fmt"%> <html:html locale="true"> <head> <link rel="stylesheet" type="text/css" href="css/eacadmin.css"> <script type="text/javascript" src="<html:rewrite href='staticJavascript.jsp'/>" ></script> </head> <body> ... The application is working fine, but the staticJavascript.jsp is downloaded for each page (I tried both IE and FireFox). Any idea why the browsers are not caching that page? Using a sniffer, here is the Request/Response I got each time: Request: GET /eacadmin/staticJavascript.jsp HTTP/1.1 Host: localhost:8080 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.8) Gecko/20050511 Firefox/1.0.4 Accept: */* Accept-Language: en-us,en;q=0.5 Accept-Encoding: gzip,deflate Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive: 300 Proxy-Connection: keep-alive Referer: http://localhost:8080/eacadmin/agencies.do Cookie: eacUserCookie=true; JSESSIONID=42975E280666F1E7455AA5EC6311BBD3 Response: HTTP/1.1 200 OK Server: Apache-Coyote/1.1 Content-Type: application/x-javascript;charset=ISO-8859-1 Date: Mon, 27 Jun 2005 10:11:29 GMT Content-Length: 34166 ..... Any idea? Thanks, Aymeric. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]