struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Mitchell" <jmitch...@apache.org>
Subject RE: bean:message , reads only once the message from MessageResource, is it caching messages for later use?
Date Tue, 19 Aug 2003 01:30:48 GMT
Yes, it is true that it is cached.  No, it is not configurable.  That's
just the way it was designed.

To get around it without actually changing the distribution, you'll need
to add something like this to your implementation's getMessage(Locale
locale, String key) method:


public String getMessage(Locale locale, String key) {
  formats.clear();   // <- this clears the HashMap from super
  // the rest of your data access code
}


I know, it's a hack, but hey, it works for me.


--
James Mitchell
Software Engineer / Struts Evangelist
http://www.struts-atlanta.org
678.910.8017
AIM:jmitchtx




> -----Original Message-----
> From: Seyhan BASMACI (Internet Yazilimlari Yetkilisi) 
> [mailto:sbasmaci@teb.com.tr] 
> Sent: Monday, August 18, 2003 10:06 AM
> To: Struts Users Mailing List
> Cc: Leyla TOLUN (Internet Yazilimlari Yonetmeni)
> Subject: bean:message , reads only once the message from 
> MessageResource, is it caching messages for later use? 
> 
> 
> 
> 	We are using DB based Messages, 
> 
> 
> 	to do this we extended  MessageResources class such as 
> 
> 	/*public class MyMessageResources extends 
> MessageResources implements Serializable { 
> 
> 	 public String getMessage(Locale locale, String key)   {
>                 DAO class that reads messages from DB only once 
> 		}
> 	*/
> 
> 
> 	im my page I am using bean:message to get page header message,
> 
> 	/*
> 	<bean:message key="header.mainpage"/>  */
> 
> 	when the page accessed ,
> 	for first time, it gets message calling  
> MyMessageResources.getMessage method,
> 
> 	but for the following acceses , it doesn't get message 
> from MyMessageResources.getMessage , in debug mode , 
> 	it enter only ONCE into MyMessageResources.getMessage 
> method , for the following acesses never enters into this method. 
> 	I think it CACHES message for later use, is that true?
> 	if so , how can cancel this  feature , because our DB 
> based message cache has reload feature , when the message 
> cache 	reloaded , all beans must show refreshed data ,,
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message