[ 
https://issues.apache.org/jira/browse/VELTOOLS-105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12606819#action_12606819
 ] 

Cott Lang commented on VELTOOLS-105:
------------------------------------

Sorry for the late response, I missed the emails on your follow-ups.

1. I am inserting my MessageResources in the RequestProcessor, under the key 
Globals.MESSAGES_KEY.  The second part of the comment for that key in 
Globals.java says that the MessageResources object will also be exposed under 
that key as a request attribute.

2. I agree - I think the proper change is to fix 
StrutsUtils.getMessageResources(req,app) to first check the request before 
checking the app - I submitted what I figured was a safer/more likely to be 
accepted patch since I figured there was a reason StrutsUtils worked that way I 
might be missing. :) 

3. Yes, this patch is for 1.4

4. I'm hazy now on my deeper investigation last month, but looking at the 2.0 
beta1 tag in svn, it looks like in my situation, MessageResourcesTool, having 
no bundle and no resources, will only call 
StrutsUtils.getMessageResources(req,app) and fail. 

StrutsUtils.getMessageResources(req,app) only checks the ServletContext and not 
the request, so it seems like it would still fail ?

If I'm misreading this, let me know. I can probably arrange some time to give 
2.0 a whirl in the next week or two.

Thanks!


> MessageTool doesn't support MessageResources the same way Struts does in 
> terms of scoping
> -----------------------------------------------------------------------------------------
>
>                 Key: VELTOOLS-105
>                 URL: https://issues.apache.org/jira/browse/VELTOOLS-105
>             Project: Velocity Tools
>          Issue Type: Bug
>          Components: VelocityStruts
>    Affects Versions: 1.4, 2.0
>            Reporter: Cott Lang
>         Attachments: MessageResourcesTool.patch1
>
>
> We have an application that, for various reasons, inserts it's own 
> MessageResources object into the Request in the RequestProcessor.
> We do not have message-resource defined in the struts config.
> This works fine in Struts, because Struts (at least 1.2.9)  defaults 'bundle' 
> to Globals.MESSAGES_KEY if it's null and checks the page, request, and 
> application scopes in that order (see TagUtils)
> StrutsUtils has similar behavior.  Unfortunately, MessageResourcesTool 
> prevents it from working because getResources() returns an error if 'bundle' 
> is null and there was not a MessageResources in the ServletContext. 
> I fixed this by simply changing MessageResourcesTool to return the locally 
> cached 'resources' object if 'bundle' is null and resources is not, but 
> otherwise to call StrutsUtils and let it find the MessageResources.  To be 
> completely compatible with Struts, it seems like StrutsUtils also needs to be 
> modified to check the page scope before the request scope.
> 2.0 is different, but looks like it would still suffer from this problem in 
> our application. 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to