struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukasz Lenart (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4830) Override TextProvider doesnot work in struts 2.5.12
Date Sun, 30 Jul 2017 09:47:00 GMT

    [ https://issues.apache.org/jira/browse/WW-4830?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16106408#comment-16106408
] 

Lukasz Lenart commented on WW-4830:
-----------------------------------

You should use {{TextProviderFactory}} instead, the {{DefaultTextProvider}} is only used internally
as a fallback solution a which soon should also be dropped.

Here you have an example how to implement your custom factory
https://github.com/apache/struts-examples/blob/master/text-provider/

Here is some more details about that
https://struts.apache.org/docs/localization.html#Localization-CustomTextProviderandTextProviderFactory

> Override TextProvider doesnot work in struts 2.5.12
> ---------------------------------------------------
>
>                 Key: WW-4830
>                 URL: https://issues.apache.org/jira/browse/WW-4830
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.5.12
>            Reporter: Alireza Fattahi
>             Fix For: 2.5.13
>
>
> In struts 2.3 , to override the TextProvider we used below
> {code:xml}
> 	<constant name="struts.xworkTextProvider" value="DefaultTextProvider" />
> 	<bean type="com.opensymphony.xwork2.TextProvider" name="DefaultTextProvider" class=".utils.CustomTextProvider"
scope="default" />
> {code}
> And make CustomTextProvider
> {code}
> 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
> }
> {code}
> 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 ?!



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message