Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.2.4
-
None
-
Operating System: All
Platform: PC
-
32270
Description
I have a setup where setting a common MessageResources in struts-config.xml
isn't possible. See this user@struts.apache.org thread
http://mail-archives.apache.org/eyebrowse/BrowseList?listName=user@struts.apache.org&by=thread&from=935909
I have researched on JavascriptValidatorTag and MessagesTag and found that
MessagesTag (by TagUtils) is already looking for the MessageResources on the
pageContext, the request and the servletContext (in that order).
There by I can easily override the MessageResources by extending the
RequestProcessor and add the right MessageResources to the request in
processPreprocess(...)
This works for MessagesTag, but not JavascriptValidatorTag because it only looks
in the servletContext (without TagUtils).
The following two patches makes JavascriptValidatorTag use TagUtils too:
src/share/org/apache/struts/taglib/html/JavascriptValidatorTag.java:
414,416c414,417
< (MessageResources) pageContext.getAttribute(
< bundle + config.getPrefix(),
< PageContext.APPLICATION_SCOPE);
—
> TagUtils.getInstance().retrieveMessageResources(
> pageContext,
> bundle,
> false);
src/share/org/apache/struts/taglib/TagUtils.java:
< private MessageResources retrieveMessageResources(
—
> public MessageResources retrieveMessageResources(