You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anna Hristova <an...@wizcom.bg> on 2001/05/17 11:55:03 UTC
Multiple ApplicationResorces within one application?
I have one application divided in different logical modules:
|_web-inf
|_ classes
|_com
|_modules
|_module1
|_actions
|_forms
|_resources
ApplicationResources.properties
|_taglib
|_module2
.....
|_resources
ApplicationResources.properties
....
|_util
|_resources
ApplicationResources.properties
So I have different 'ApplicationResources.properties' for the different
modules and one that is shared. The particular problem that I encountered is
with ActionErrors, because I don't see a way to say from my FormBean for
example what properties file to use. Do you have any idea how can I easily
(without rewriting a lot of classes) solve this?
Thank you in advance.
Anna
Re: Multiple ApplicationResorces within one application?
Posted by Peter Alfors <pe...@irista.com>.
Here is one solution...
Add additional parameter(s) to the servlet in web.xml.
<init-param>
<param-name>application</param-name>
<param-value>com.ui.resources.application</param-value>
</init-param>
<init-param>
<param-name>constants</param-name>
<param-value>com.ui.resources.constants</param-value>
</init-param>
Then subclass the ActionServlet class and over-ride the init() method to
initialize both the application and constant resources and place them into
different servlet context attributes.
This way, taglibs / actions / pages can specify which bundles to use by the
servletcontext attribute key.
HTH,
Pete
Anna Hristova wrote:
> I have one application divided in different logical modules:
>
> |_web-inf
> |_ classes
> |_com
> |_modules
> |_module1
> |_actions
> |_forms
> |_resources
> ApplicationResources.properties
> |_taglib
> |_module2
> .....
> |_resources
> ApplicationResources.properties
> ....
> |_util
> |_resources
> ApplicationResources.properties
>
> So I have different 'ApplicationResources.properties' for the different
> modules and one that is shared. The particular problem that I encountered is
> with ActionErrors, because I don't see a way to say from my FormBean for
> example what properties file to use. Do you have any idea how can I easily
> (without rewriting a lot of classes) solve this?
>
> Thank you in advance.
> Anna
RE: Multiple ApplicationResorces within one application?
Posted by Niall Pemberton <ni...@btInternet.com>.
Cocatenate all your module ApplicationResources files into one large one
when you deploy it to your servlet container.
> -----Original Message-----
> From: Anna Hristova [mailto:ani@wizcom.bg]
> Sent: 17 May 2001 10:55
> To: Struts-User
> Subject: Multiple ApplicationResorces within one application?
>
>
> I have one application divided in different logical modules:
>
> |_web-inf
> |_ classes
> |_com
> |_modules
> |_module1
> |_actions
> |_forms
> |_resources
> ApplicationResources.properties
> |_taglib
> |_module2
> .....
> |_resources
> ApplicationResources.properties
> ....
> |_util
> |_resources
> ApplicationResources.properties
>
> So I have different 'ApplicationResources.properties' for the different
> modules and one that is shared. The particular problem that I
> encountered is
> with ActionErrors, because I don't see a way to say from my FormBean for
> example what properties file to use. Do you have any idea how can I easily
> (without rewriting a lot of classes) solve this?
>
> Thank you in advance.
> Anna
>
>