You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by "Don Brown (JIRA)" <ji...@apache.org> on 2006/04/25 21:00:48 UTC

[jira] Closed: (STR-798) MessageResources is not module aware

     [ http://issues.apache.org/struts/browse/STR-798?page=all ]
     
Don Brown closed STR-798:
-------------------------

    Resolution: Fixed

> MessageResources is not module aware
> ------------------------------------
>
>          Key: STR-798
>          URL: http://issues.apache.org/struts/browse/STR-798
>      Project: Struts Action 1
>         Type: Bug

>   Components: Action
>     Versions: Nightly Build
>  Environment: Operating System: other
> Platform: All
>     Reporter: Alex Kwan
>     Assignee: Martin Cooper
>      Fix For: 1.2 Family

>
> 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"

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/struts/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org