Hello,
Craig Tataryn wrote:
> But technically couldn't the application developer do this already? They
> could just add another init-param to the Servlet which specified a
> Resources class other than the default. The servlet writter would simply
> use this resource bundle instead, getting it's messages from there.
The problem with the init-param 'factory', which you can use for
setting a MessagerResourcesFactory for use of your application
MessageResources (i.e. those which you access with your
<bean:message/> tags by default), is, that you can't set any extra
parameters for you own factory. This is no a serious problem by its
own, since you can always subclass ActionServlet and override
'initApplication()'. The point is, that at the moment, you need to
duplicate a lot of code from ActionServlet.initApplication() only for
setting some extra parameter (the suggestion was to introduce an extra
protected method in ActionServlet like 'initMessageResourcesFactory()'
to make subclassing easier).
> You could have something like UIResource and ServletResource classes. The
> UIResource class would be the one you set in the ActionServlet's
> application init-param, and the ServletResource class can be loaded
> programatically by the servlet writter based on some custom init-param
> which specified the class name.
Martin Cooper wrote:
> Isn't this essentially why the "bundle" attribute was added to the
> <bean:message> tag? That would seem to solve the problem, although I guess
> it means you'd have to add that attribute to all your <bean:message> instances.
You are right, this is a solution if you want to switch to different
MessageResources. But this is tedious, if you really only want to set
a new default application ResourceMessages.
Anyway, I think that an alternate MessageResources which get its messages from a
file somewhere below the servlet context would be a good idea for the
main struts development branch.....
--
...roland huss
consol.de