You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ta...@ubs.com on 2002/06/04 11:36:07 UTC
Caching problem with
Hi all
we need to get some nls-resource out of a db. to implement this I started with
a own subclass of
org.apache.struts.util.PropertyMessageResources and the factroy class.
for the beginning, I just overwrote the following method:
public String getMessage(Locale locale, String key)
{
System.out.println("MyMessageResource::getMessage : "+key+", for
"+locale);
// simulating some real dynamic message
if( key.equals("test") )
{
// in future this would be a dbaccess
return (new Date()).toString();
}
else
{
return super.getMessage(locale, key);
}
}
on my test page I can set 2 locales dynamicly (en and de). the method above is
only called once for each <bean:message key="key"> tag and locale. this means:
- first time access to the jsp with de => method will be called with a output
like "MyMessageResource::getMessage : test, for de". on the page the actual
Date object is shown
- i change the locale to en => method will be called again with a output like
"MyMessageResource::getMessage : test, for en". again the actual Date object
(newer than befor) is shown.
after this, the method is never called again, even
- not, when i change locale (it changes between the english and german page,
but do not call the method)
- not, when i reload the page
my jsp contains following lines to avoid caching
<meta http-equiv="expires" content="0">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
the change of locale is a link to an action, which sets the locale and forwards
to the same jsp back.
when I start another browser (I had nescape and started opera afterthat); I see
the old date object created when I accessed the page from the other browser.
this looks like there is some caching on the serverside ??
any ideas about that ?
regards
tamer
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>