You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Igor Vlasov <vi...@mail.ru> on 2007/10/24 15:41:38 UTC

[S2] Configure XWork TextProvider with struts.properties does not work

Hello

I try to use my own TextProvider implementation.

1)I try to use this by adding 
&lt;bean type="com.opensymphony.xwork2.TextProvider" name="xwork1"
class="karakas.struts.RicoTextProvider" />

to struts.xml.

This caused
Unable to load bean: type:com.opensymphony.xwork2.TextProvider
class:karakas.struts.RicoTextProvider - bean -
file:/D:/projects/Karakas1.1/build/web/WEB-INF/classes/struts.xml:10:109

Caused by: Bean type interface com.opensymphony.xwork2.TextProvider with the
name xwork1 has already been loaded by [unknown location] - bean - 
:sleep:

2) I moved stuts-default.xml from struts.jar to classes dir and wrote:

    <bean type="com.opensymphony.xwork2.TextProvider" name="xwork1"
class="karakas.struts.RicoTextProvider" />
    <bean type="com.opensymphony.xwork2.TextProvider" name="struts"
class="karakas.struts.RicoTextProvider" />

And nothing happend :-((

4)I do a google search and find 
https://issues.apache.org/struts/browse/WW-1748 WW-1748 

With this improvment i can use struts.properties to determine TextProvider
implementation

i wrote 
struts.xworkTextProvider=karakas.struts.RicoTextProvider
in struts.properties

and nothing happend :-(

3) then i looked as  ActionSupport and TextProviderFactory (XWork v2.1.0) 

and find :

public class TextProviderFactory {

    private TextProvider textProvider;

    @Inject
    public void setTextProvider(TextProvider textProvider) {
        this.textProvider = textProvider;
    }

    protected TextProvider getTextProvider() {
        if (this.textProvider == null) {
            return new TextProviderSupport();
        } else {
            return textProvider;
        }
    }

    public TextProvider createInstance(Class clazz, LocaleProvider provider)
{
        TextProvider instance = getTextProvider();
        if (instance instanceof ResourceBundleTextProvider) {
            ((ResourceBundleTextProvider) instance).setClazz(clazz);
            ((ResourceBundleTextProvider)
instance).setLocaleProvider(provider);
        }
        return instance;
    }
......


the method setTextProvider never callen and i always get
TextProviderSupport();
:-((



 



 

-- 
View this message in context: http://www.nabble.com/-S2--Configure-XWork-TextProvider-with-struts.properties-does-not-work-tf4683982.html#a13384547
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org