You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nate Drake <nd...@gmail.com> on 2006/11/17 16:19:18 UTC
[s2] Message resources from database
Hi,
We're in the process of migrating a Struts1 app to Struts2. In Struts1 we
created a subclass of PropertyMessageResources to get our messages from the
database instead of properties files. I can't seem to find how we'd go about
doing this in Struts2. Do I just subclass
com.opensymphony.xwork.util.LocalizedTextUtil and configure the
framework to use it?
Thanks!
Nate
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [s2] Message resources from database
Posted by Wendy Smoak <ws...@gmail.com>.
On 11/21/06, Craig McClanahan <cr...@apache.org> wrote:
> It's perfectly reasonable to consider using it in a Struts
> example, if you want.
... and it's available in the central Maven repo in group id
org.apache.shale.extras:
http://repo1.maven.org/maven2/org/apache/shale/extras/mailreader-jpa/1.0.3/
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: [s2] Message resources from database
Posted by Craig McClanahan <cr...@apache.org>.
On 11/21/06, Ted Husted <hu...@apache.org> wrote:
>
> Is "JPAMailreaderDao" part of this
>
> *
> http://sourceforge.net/project/showfiles.php?group_id=49385&package_id=149742
>
> or is it a Shale thing?
The mailreader-jpa[1] "shale thing" :-) is actually independent of Shale, in
the same way that mailreader-dao has been independent of Struts. The
contents are a persistence.xml file and the corresponding JPA entity
classes. It's perfectly reasonable to consider using it in a Struts
example, if you want.
-T.
Craig
[1]
http://svn.apache.org/viewvc/shale/framework/trunk/shale-apps/mailreader-jpa/
Re: [s2] Message resources from database
Posted by James Mitchell <ja...@mac.com>.
LOL....no, I was speaking hypothetically.
--
James Mitchell
678.910.8017
On Nov 21, 2006, at 2:53 PM, Ted Husted wrote:
> Is "JPAMailreaderDao" part of this
>
> * http://sourceforge.net/project/showfiles.php?
> group_id=49385&package_id=149742
>
> or is it a Shale thing?
>
> -T.
>
> On 11/21/06, James Mitchell <ja...@mac.com> wrote:
>> That would be a nice addition to show off a JPAMailreaderDao with a
>> db backed resource bundle.
>>
>>
>> --
>> James Mitchell
>> 678.910.8017
>>
>>
>>
>>
>> On Nov 21, 2006, at 2:21 PM, Ted Husted wrote:
>>
>> > Ahh, yes, page 377.
>> >
>> > Now, to embarass me further, do we cover the technique anywhere
>> in the
>> > Struts 2 dcocumentation? It seems straight forward. Perhaps, we
>> could
>> > even do it for the MailReader.
>> >
>> > -Ted.
>> >
>> > On 11/21/06, Jason Carreira <fo...@opensymphony.com>
>> wrote:
>> >> I thought you read WebWork in Action ;-)
>> >> There's a DB-driven ResourceBundle described in there and in the
>> >> source code for the book.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: [s2] Message resources from database
Posted by Ted Husted <hu...@apache.org>.
Is "JPAMailreaderDao" part of this
* http://sourceforge.net/project/showfiles.php?group_id=49385&package_id=149742
or is it a Shale thing?
-T.
On 11/21/06, James Mitchell <ja...@mac.com> wrote:
> That would be a nice addition to show off a JPAMailreaderDao with a
> db backed resource bundle.
>
>
> --
> James Mitchell
> 678.910.8017
>
>
>
>
> On Nov 21, 2006, at 2:21 PM, Ted Husted wrote:
>
> > Ahh, yes, page 377.
> >
> > Now, to embarass me further, do we cover the technique anywhere in the
> > Struts 2 dcocumentation? It seems straight forward. Perhaps, we could
> > even do it for the MailReader.
> >
> > -Ted.
> >
> > On 11/21/06, Jason Carreira <fo...@opensymphony.com> wrote:
> >> I thought you read WebWork in Action ;-)
> >> There's a DB-driven ResourceBundle described in there and in the
> >> source code for the book.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: [s2] Message resources from database
Posted by James Mitchell <ja...@mac.com>.
That would be a nice addition to show off a JPAMailreaderDao with a
db backed resource bundle.
--
James Mitchell
678.910.8017
On Nov 21, 2006, at 2:21 PM, Ted Husted wrote:
> Ahh, yes, page 377.
>
> Now, to embarass me further, do we cover the technique anywhere in the
> Struts 2 dcocumentation? It seems straight forward. Perhaps, we could
> even do it for the MailReader.
>
> -Ted.
>
> On 11/21/06, Jason Carreira <fo...@opensymphony.com> wrote:
>> I thought you read WebWork in Action ;-)
>> There's a DB-driven ResourceBundle described in there and in the
>> source code for the book.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: Fwd: [s2] Message resources from database
Posted by Ted Husted <hu...@apache.org>.
Ahh, yes, page 377.
Now, to embarass me further, do we cover the technique anywhere in the
Struts 2 dcocumentation? It seems straight forward. Perhaps, we could
even do it for the MailReader.
-Ted.
On 11/21/06, Jason Carreira <fo...@opensymphony.com> wrote:
> I thought you read WebWork in Action ;-)
> There's a DB-driven ResourceBundle described in there and in the source code for the book.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: Fwd: [s2] Message resources from database
Posted by Jason Carreira <fo...@opensymphony.com>.
I thought you read WebWork in Action ;-) There's a DB-driven ResourceBundle described in there and in the source code for the book.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=50877&messageID=102710#102710
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Fwd: [s2] Message resources from database
Posted by Ted Husted <hu...@apache.org>.
This question has come up a couple of times, and I don't think I've
seen an answer.
Is there a database solution for X2/S2 message resources floating around?
If not, we should say so on the "Struts 1 Solutions" FAQ, since it's a
reasonably common use case, and people will continue to ask.
-Ted.
---------- Forwarded message ----------
From: Nate Drake <nd...@gmail.com>
Date: Nov 17, 2006 10:19 AM
Subject: [s2] Message resources from database
To: user@struts.apache.org
Hi,
We're in the process of migrating a Struts1 app to Struts2. In Struts1 we
created a subclass of PropertyMessageResources to get our messages from the
database instead of properties files. I can't seem to find how we'd go about
doing this in Struts2. Do I just subclass
com.opensymphony.xwork.util.LocalizedTextUtil and configure the
framework to use it?
Thanks!
Nate
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org
Re: [s2] Message resources from database
Posted by Ted Husted <hu...@apache.org>.
On 11/25/06, Ted Husted <hu...@apache.org> wrote:
> Essentially, you can implement the Java ResourceBundle interface
/s/implement the Java ResourceBundle interface/extend the Java
ResourceBundle class
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: [s2] Message resources from database
Posted by Ted Husted <hu...@apache.org>.
It's actually fairly simple to do. There's a detailed example in the
WebWork in Action book (see page 375).
Struts 2 (and WW2) search the class heirarchy for message resources,
looking first for classes that
Essentially, you can implement the Java ResourceBundle interface and
have it lookup the messages from whereever. You can then plug the
class in using a Struts 2 property
struts.custom.i18n = MyResourceBundle
or by calling
LocalizedTextUtil.addDefaultResourceBundle("MyResourceBundle")
from a ServletContextListener at startup.
The ResourceBundle class is then discovered and utilized just like a
.properties file.
-Ted.
On 11/17/06, Nate Drake <nd...@gmail.com> wrote:
> Hi,
>
> We're in the process of migrating a Struts1 app to Struts2. In Struts1 we
> created a subclass of PropertyMessageResources to get our messages from the
> database instead of properties files. I can't seem to find how we'd go about
> doing this in Struts2. Do I just subclass
> com.opensymphony.xwork.util.LocalizedTextUtil and configure the
> framework to use it?
>
> Thanks!
>
> Nate
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org