> ----- Original Message -----
> From: "Lloyd Wilson" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Thursday, July 10, 2003 1:53 PM
> Subject: RE: Multiple Application Modules
>
>
> How would I retrieve values from my message resource bundle without a
> key??

That's not what I meant.  Using "key" in the declaration is different than
using "key" when asking for a message/value.

>
> Currently, I use the following to access a message resource bundle for
> a given JSP page. For ie. If I want to access the message resource key
> "index" from the default struts config file I do the following in my
> JSP page:
>
> Assume "index.jsp" for moduleA. (moduleA being the default "/")
>
> ...
> <title>
>   <bean:message bundle="index" key="page.title" />
> </tilte>
> ...
>
> This snippet of code will look at the "index" message resource bundle
> defined in the default struts config file and get the key "page.title".

That's right.

> This displays the title for that page. Within the same page in the body
> I have a link to the module b test page like so:
>
> <html:link forward="moduleb">ModuleB</html:link>
>
> When the page renders, the forward "moduleb" becomes "/moduleb/test.jsp"
> for example which is defined as a forward within the default struts
> config file.

You cannot link directly to a jsp and expect Struts to change the Module.
It might seem that since you are using a forward from the struts-config
that it would be enough, but that's not the case.  You must explicitely
"switch" to Module B.

I wrote a small demo app that demonstrates 3 ways to do this.
It is here:
http://prdownloads.sourceforge.net/struts/simple-modules-example.tar.gz?down
load

>
> When the user clicks on the link, the switch occurs to the module b
> struts config file no problem and renders the page appropriately. The
> ONLY problem I have is defining the message resource bundle within the
> module b struts config file. Let's say for clarity I have within the
> test.jsp for module b the following code:
>
> ...
> <title>
>   <bean:message bundle="test" key="page.title" />
> </tilte>
> ...
>
> If I attempt to render this page with the following code and the message
> resource bundle configured in the struts config file for module b it will
> NOT work. The only way it will work properly is if it's defined in the
> default struts config file (module a). I do have a workaround which is
> to define all the message resource bundles in the default struts config
> file, but I JUST want to know if this appears to be a problem that I am
> only having or if this should be reported as a bug?
>
> I'm not sure how to better clarify my problem. I hope the above helps.
>
> Cheers,
> Lloyd
>
>
> -----Original Message-----
> From: James Mitchell [mailto:[EMAIL PROTECTED]
> Sent: Thursday, July 10, 2003 12:50 PM
> To: Struts Users Mailing List
> Subject: Re: Multiple Application Modules
>
>
> ----- Original Message -----
> From: "James Mitchell" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Thursday, July 10, 2003 12:42 PM
> Subject: Re: Multiple Application Modules
>
>
> > > ----- Original Message -----
> > > From: "Lloyd Wilson" <[EMAIL PROTECTED]>
> > > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > > Sent: Thursday, July 10, 2003 12:24 PM
> > > Subject: RE: Multiple Application Modules
> > >
> > >
> > > The message resource settings only occur in the default struts config
> file
> > as I can't pick up the message resources from the other struts config
> > modules.
> > >
> > > Here is what i'm trying to do:
> > >
> > > Module A (default struts config)
> > >
> > >   <message-resources
> > >     key="index"
> > >     parameter="resources.Index"
> > >     null="false" />
> > >
> > > Module B
> > >
> > >   <message-resources
> > >     key="test"
> > >     parameter="resources.moduleB.Test"
> > >     null="false" />
> > >
> > > For some reason I cannot use the "test" message resource bundle
> > > when viewing a page from ModuleB unless I have defined it in ModuleA.
> > >
> > > Does that help at all?
> > >
> >
> > Not really.  Typically, you wouldn't need to specify a key for "Module
B"
> > (unless you
> > just want to).
>
> Sorry, meant to say that you don't need to specify a key for any Module
> unless you have more than one FOR THAT Module.
>
> >
> > When accessing a message from an action of a jsp, Struts should have
> already
> > "switched" modules.
> >
> > How are your users navigating to and from the different Modules?
> >
> >
> > --
> > James Mitchell
> > Software Developer/Struts Evangelist
> > http://www.struts-atlanta.org
> > 678-910-8017
> > AIM:jmitchtx
> >
>

--
James Mitchell
Software Developer/Struts Evangelist
http://www.struts-atlanta.org
678-910-8017
AIM:jmitchtx






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to