struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Baranski" <list-subscripti...@secmgmt.com>
Subject RE: ResourceBundle with DB backend
Date Fri, 28 Aug 2009 19:49:55 GMT

>-----Original Message-----
>From: Tommy Pham [mailto:tommyhp2@yahoo.com]
>Sent: Friday, August 28, 2009 12:44 PM
>To: Struts Users Mailing List
>Subject: Re: ResourceBundle with DB backend
>
>----- Original Message ----
>> From: Mike Baranski <list-subscriptions@secmgmt.com>
>> To: Struts Users Mailing List <user@struts.apache.org>
>> Sent: Friday, August 28, 2009 9:22:06 AM
>> Subject: RE: ResourceBundle with DB backend
>>
>> I've done it, you just implement the proper classes and tell your
>> application to use them instead.  I use a derby back-end.  I can post
>a
>> tutorial later if you'd like.
>>
>> >-----Original Message-----
>> >From: Tommy Pham [mailto:tommyhp2@yahoo.com]
>> >Sent: Friday, August 28, 2009 12:17 PM
>> >To: user@struts.apache.org
>> >Subject: ResourceBundle with DB backend
>> >
>> >
>> >Hi,
>> >
>> >After reading through Localization and Formatting Date and Numbers,
>I'm
>> >unable to find any information regarding using DB backend for
>> >ResourceBundle (by Struts specifically).  Suppose I have the proper
>DB
>> >structure to provide the proper format & results as needed, how would
>I
>> >go about getting Struts 2.1.6 to use it instead of checking the
>> >properties files through out the directory/folder hierarchy?  If I'm
>> >using Servlets+JSP, a custom class wouldn't be a problem.  I know
>it's
>> >possible on ASP.NET since I've read about it on MSDN.
>> >
>> >TIA,
>> >Tommy
>> >
>> >
>> >---------------------------------------------------------------------
>> >To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> >For additional commands, e-mail: user-help@struts.apache.org
>
>Hi Mike,
>
>Thanks for the reply.  Yes, please post the tutorial when you're
>available.  I was thinking about that too which should work fine for
>normal texts.  But how do you overcome the validation when the texts are
>in external <class>-validation.xml?  I was hoping to implement something
>that would tell struts to use my custom class instead of the default
>ResourceBundle.  So later if I decide not implement the database
>backend, there's no need to rewrite all those getTexts :D
>
>Thanks,
>Tommy

Tommy, here's the gist of what I did:

*Implement a custom ResourceBundle that loads text from derby (or whatever
database)
*Implement a base class that extends ActionSupport, that all my actions
extend
*In the constructor, get the custom ResourceBundle
*Override the getText(...) methods from my base class, and use the custom
ResourceBundle.

Hope that helps, I can post the code somewhere, too, if needed.


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


Mime
View raw message