PDA

View Full Version : Struts MessageResources


cbredesen
Oct 4th, 2005, 10:40 AM
Hi All,

I'm faced with replacing a number of properties files with database-backed MessageResources in Struts. Our legacy code simply uses JDBC configured from a properties file to access the database and create the LocaleLoaders, etc.

My current app uses Spring+Hibernate, and as such I've created the needed entities and DAO code. However, if I'm to provide a Spribernate-backed MessageResources/MessageResourcesFactory, I have to get the Spring applicationContext from somewhere. This is where I'm stuck. Neither of these classes give me access to ServletContext (that I can see, anyway).

I see one of two potential solutions:

1. Somehow get access to ApplicationContext from MessageResources[Factory] -- any ideas how?

2. Use Spring's MessageSource and somehow connect it to an adapter which lets Struts access it like a native MessageResources instance. I don't see any support for this.

We aren't using DelegatingActions; we're simply extending Spring's ActionSupport classes for easy access to WebAppContext....

Any ideas would be much appreciated!

Thanks,

Chris

cbredesen
Oct 4th, 2005, 07:06 PM
I posed this issue on struts-user, and some fairly constructive conversation sprouted, though no immediate solutions. I'm including this here in case anyone in the future finds this thread pertinent.

http://www.mail-archive.com/user%40struts.apache.org/msg34966.html

-Chris