My apologies if somebody thinks this is off topic, but here�s the deal:

When the user logs in s/he chooses a language.
We have some JavaScripts common for all pages which, for example makes
sure the user inputs a valid integer. If s/he doesn�t, s/he�ll get an
alert in the preferred language.
These scripts are in a common file (common.js), referenced from all
pages. The reasons are of course maintainability and caching for
download speed. 

Problem:
The language specific messages have to be fetched from the database and
thus generated on the server. If I make the common.js file a common.jsp
with dynamic strings, IT DOESN�T get chached! (I do a System.out and can
see it is requested even every time I reload a page)

Question:
Does this have to with that none of the pages referencing common.js(p)
are allowed to cache?
Can I force cache on a page, like response.setHeader("Cache-Control",
"always-cache"); ?

Workaround:
Since I really don't want my scripts to reload on every page (they are
larger than some of the pages), I have found two other solutions:
1) Make another script (say jsTexts.jsp) file with global string
variables. The problem is the browser needs an extra call to the server
for each page.
2) Include the global strings in the head of ever page. (Ugly!)

Any other suggestions?


  Mattias Jiderhamn
  Expert Systems
  [EMAIL PROTECTED]
�

==========================================================================To 
unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
 http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets

Reply via email to