Uploaded image for project: 'Struts 1'
  1. Struts 1
  2. STR-2285

Let JavasvriptValidatorTag use custom MessageResources for i18n texts

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.2.4
    • 1.2 Family
    • Core
    • 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(

      Attachments

        Activity

          People

            Unassigned Unassigned
            cb@touristonline.dk Christian Bjørnbak
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: