Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-4830

Override TextProvider doesnot work in struts 2.5.12

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 2.5.12
    • 2.5.13
    • Core
    • None

    Description

      In struts 2.3 , to override the TextProvider we used below

      	<constant name="struts.xworkTextProvider" value="DefaultTextProvider" />
      	<bean type="com.opensymphony.xwork2.TextProvider" name="DefaultTextProvider" class=".utils.CustomTextProvider" scope="default" />
      
      

      And make CustomTextProvider

      public class CustomTextProvider extends DefaultTextProvider{
      
      public String getText(String key, String defaultValue, List<?> args) {
              String text = super.getText(key, defaultValue, args);
              //Do something with the text
              //and return it
          }
      
       //other getText methods can be override too
      }
      

      This seems not to be worked at Struts 2.15.2.

      To make some test, I remove my bean from* strust.xml* and put some break points in *DefaultTextProvider *the *getText *of this class is not called, however I find that the *TextProviderSupport **getText *method is called.

      Should we override other classes ?!

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            afattahi Alireza Fattahi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment