You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Karr, David" <da...@attws.com> on 2002/10/15 17:12:10 UTC

RE: How to change errors.header and errros.footer Dynamically???? ???

Actually, another alternative would be the ability to change which message
keys are being used, instead of changing the resources themselves.  You can
presently (at least in the nightly build) change the "header" and "footer"
keys for the "messages" tag, but not the prefix or suffix, and none of those
for the "errors" tag.  I recently submitted an enhancement request to
address this for both tags.  I was hoping to get more feedback on that in
the next day or so.

> -----Original Message-----
> From: James Mitchell [mailto:jmitchtx@telocity.com]
> Sent: Tuesday, October 15, 2002 7:58 AM
> To: Struts Users Mailing List
> Subject: RE: How to change errors.header and errros.footer
> Dynamically???????
> 
> Sorry, you won't be able to do this with the correct API.
> The messages are cached in both PropertyMessageResources and its super
> (MessageResources).
> 
> So, you would need something like DBMessageResources, which is a
> MessageResources implementation I developed to support 
> messages in a RDBMS.
> I'm almost finished with the admin tool that will let you change (at
> runtime) the messages.
> 
> Using this extension requires having the messages in a 
> database, so this is
> not for everyone.
> 
> 
> 
> James Mitchell
> Software Engineer/Struts Evangelist
> http://www.open-tools.org
> 
> 
> 
> 
> > -----Original Message-----
> > From: samit.goyal [mailto:samit.goyal@tatainfotech.com]
> > Sent: Tuesday, October 15, 2002 7:46 AM
> > To: Struts Users Mailing List
> > Subject: How to change errors.header and errros.footer
> > Dynamically???????
> >
> >
> > Hi all,
> >
> > Can any one of you pls help me in dynamically modifying the 
> errors.header
> > and errors.footer from my action class???
> >
> > Thanks in advance!!
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
> 
> 
> --
> To unsubscribe, e-mail:   
> <ma...@jakarta.apache.org>
> For additional commands, e-mail: 
> <ma...@jakarta.apache.org>
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: How to change errors.header and errros.footer Dynamically???????

Posted by James Mitchell <jm...@telocity.com>.
I get around the internal (MessageResources) caching by getting the
protected Hashmap and flushing it:

...
	// Override the default behavior of MessageResources caching
		if (clearCache){
			synchronized (formats) {
				formats.clear();
			}
		}
...
...


By making clearCache configurable, I can set it to false for performance >=
normal except that I do not load an entire set of properties (as is done in
the default impl), but they are retrieved by key when requested (through the
app).  In this case the app starts quicker, but is a bit (by milliseconds)
slower until all the messages have been retrieved (and cached), which takes
a while, depending on number of users.



James Mitchell
Software Engineer/Struts Evangelist
http://www.open-tools.org




> -----Original Message-----
> From: Karr, David [mailto:david.karr@attws.com]
> Sent: Tuesday, October 15, 2002 11:12 AM
> To: 'Struts Users Mailing List'
> Subject: RE: How to change errors.header and errros.footer
> Dynamically???????
>
>
> Actually, another alternative would be the ability to change which message
> keys are being used, instead of changing the resources
> themselves.  You can
> presently (at least in the nightly build) change the "header" and "footer"
> keys for the "messages" tag, but not the prefix or suffix, and
> none of those
> for the "errors" tag.  I recently submitted an enhancement request to
> address this for both tags.  I was hoping to get more feedback on that in
> the next day or so.
>
> > -----Original Message-----
> > From: James Mitchell [mailto:jmitchtx@telocity.com]
> > Sent: Tuesday, October 15, 2002 7:58 AM
> > To: Struts Users Mailing List
> > Subject: RE: How to change errors.header and errros.footer
> > Dynamically???????
> >
> > Sorry, you won't be able to do this with the correct API.
> > The messages are cached in both PropertyMessageResources and its super
> > (MessageResources).
> >
> > So, you would need something like DBMessageResources, which is a
> > MessageResources implementation I developed to support
> > messages in a RDBMS.
> > I'm almost finished with the admin tool that will let you change (at
> > runtime) the messages.
> >
> > Using this extension requires having the messages in a
> > database, so this is
> > not for everyone.
> >
> >
> >
> > James Mitchell
> > Software Engineer/Struts Evangelist
> > http://www.open-tools.org
> >
> >
> >
> >
> > > -----Original Message-----
> > > From: samit.goyal [mailto:samit.goyal@tatainfotech.com]
> > > Sent: Tuesday, October 15, 2002 7:46 AM
> > > To: Struts Users Mailing List
> > > Subject: How to change errors.header and errros.footer
> > > Dynamically???????
> > >
> > >
> > > Hi all,
> > >
> > > Can any one of you pls help me in dynamically modifying the
> > errors.header
> > > and errors.footer from my action class???
> > >
> > > Thanks in advance!!
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > > <ma...@jakarta.apache.org>
> > > For additional commands, e-mail:
> > > <ma...@jakarta.apache.org>
> > >
> > >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>