You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2002/08/22 15:52:31 UTC
DO NOT REPLY [Bug 11932] New: -
(Message Resource is not multi-app aware) Multi-Resource not work in Multi-Appliction config environment
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11932>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11932
(Message Resource is not multi-app aware) Multi-Resource not work in Multi-Appliction config environment
Summary: (Message Resource is not multi-app aware) Multi-Resource
not work in Multi-Appliction config environment
Product: Struts
Version: Nightly Build
Platform: All
OS/Version: Other
Status: NEW
Severity: Major
Priority: Other
Component: Unknown
AssignedTo: struts-dev@jakarta.apache.org
ReportedBy: erazor@etang.com
Suppose we define a sub app in web.xml as below
...
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/configs/default/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>config/sample</param-name>
<param-value>/WEB-INF/configs/sample/struts-config.xml</param-value>
</init-param>
...
and in the default struts-config.xml file,
we add the following message resouces
...
<message-resources parameter="DefaultMessageResources"/>
<message-resources key="IMAGE_RESOURCES_KEY" parameter="DefaultImageResources"/>
...
now we create two message resources in the sub app sample's struts-config.xml
...
<message-resources parameter="SampleMessageResources"/>
<message-resources key="IMAGE_RESOURCES_KEY" parameter="SampleImageResources"/>
...
then we create a test.jsp in path /webroot/sample/
the file contains the following line
...
<bean:message key="test"/>
...
<html:img bundle="IMAGE_RESOURCES_KEY" pageKey="test.img"/>
...
the problem is the message tag renders fine but the img tag came out with
something like <img src="http://hostaddress/contextPath/samplenull
I checked the source of class ImgTag and found it get the src path through
...
return (request.getContextPath() + config.getPrefix() +
RequestUtils.message(pageContext, getBundle(), getLocale(),
this.pageKey));
...
but in RequestUtils.message method
// Look up the requested MessageResources
if (bundle == null) {
bundle = Action.MESSAGES_KEY;
resources = (MessageResources)
pageContext.getAttribute(bundle, PageContext.REQUEST_SCOPE);
}
if (resources == null) {
resources = (MessageResources)
pageContext.getAttribute(bundle,
PageContext.APPLICATION_SCOPE);
}
it simply first check for the default message then go to get bundle int
application scope.
so if i want use the img tag, I must specify the bundle as
bundle="IMAGE_RESOURCES_KEY/sample"
Now my question is whether we can just use the img tag as the message tag, like
bundle="IMAGE_RESOURCES_KEY"
it's much graceful than bundle="IMAGE_RESOURCES_KEY/sample"
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>