Here's something that appears to be a step in the right direction. First, use a
single context init param for javax.servlet.jsp.jstl.fmt.localizationContext.
The <param-value> content should match the "parameter" attribute of the
<message-resources> element in your default Struts config file. For example,
your default Struts config file would include:
<message-resources parameter="com.obs.webapp.messages.Messages"/>
Then, add something like the following to a module Struts config file:
<message-resources parameter="com.obs.webapp.messages.MessagesModule1"/>
Finally, extend SwitchAction like so:
import javax.servlet.jsp.jstl.core.Config;
...
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
ActionForward forward = super.execute(mapping, form, request, response);
ModuleConfig moduleConfig =
RequestUtils.getModuleConfig(request, getServlet().getServletContext());
MessageResourcesConfig messageConfig =
moduleConfig.findMessageResourcesConfig(Globals.MESSAGES_KEY);
if (messageConfig != null) {
Config.set(request,
Config.FMT_LOCALIZATION_CONTEXT,
messageConfig.getParameter());
}
return forward;
}
So, as long as you use the new switch action to move between modules, it should
pick up the messages associated with the new module and make them available to
JSTL. I haven't looked into how to integrate with module switching via a forward
with "contextRelative=true", but there might be something possible there as well...
Quoting Carlos Sanchez <[EMAIL PROTECTED]>:
> I'm using JSTL + Struts configured for modules
>
> I'm using JSTL fmt tag for messages, instead of Struts tags, configured in
> web.xml
>
> <context-param>
> <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
> <param-value>com.obs.webapp.messages.Messages</param-value>
> </context-param>
>
> I'd like to add more message resources, one for each module.
>
> Adding more context-param's doesn't work, it uses the last one.
>
> Can I configure it in web.xml, have I to use fmt:setBundle in the jsps,
> ...?
--
Kris Schneider <mailto:[EMAIL PROTECTED]>
D.O.Tech <http://www.dotech.com/>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]