The main goal:
I want to get i18n strings from properties files in UTF-8 encoding.
The secondary goal:
Load current locale setting from JSTL config variables like
Config.FMT_LOCALIZATION_CONTEXT and its locale variable value
Thus I will use jstl-fmt tags and strust i18n support TOGETHER !!!!:clap:
I do not want to override method in actions. I want to change global
behaviour of getting localized string in ONE special component/class.
I think, than I can replace TextProvider with my own implementation that
will read in UTF-8(or convert readed string to UTF-8) and getting current
locale information from pagecontext(probably)
I looked at <i18n> and in also use TextProvider.
Don Brown wrote:
>
> Currently, the TextProvider impl is not pluggable. Note that Action
> classes themselves can implement TextProvider (and usually do via
> ActionSupport), so they can customize it all they need.
>
> What is your usecase for having your own TextProvider? That class is
> only used in a few places, so perhaps what you really need is just to
> override the appropriate methods on your Action.
>
> Don
>
> On 10/26/07, Igor Vlasov <[EMAIL PROTECTED]> wrote:
>>
>> The class
>> com.opensymphony.xwork2.config.providers.XmlConfigurationProvider
>> in method register(...) use this logic for checking....
>>
>> if (containerBuilder.contains(ctype, name)) {
>> Location loc =
>> LocationUtils.getLocation(loadedBeans.get(ctype.getName() + name));
>> if (throwExceptionOnDuplicateBeans) {
>> throw new ConfigurationException("Bean type " + ctype +
>> "
>> with the name " +
>> name + " has already been loaded by " + loc,
>> child);
>> }
>> }
>> Thus I CAN NOT register 2 bean with same type and name!!!
>>
>> I can register new TextProvider with defferent name:xxxstruts . But I am
>> not
>> sure that exactly my bean will be used to create an object for
>> TextProvider.
>>
>> At that time there is a bug in XWork 2.0.1....2.1.0 when TextProvider
>> object is created.
>>
>> I want to investigate the common method for loading my realization of
>> standart bean.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> cilquirm wrote:
>> >
>> > I think the problem might be that there may not be a way to configure a
>> > different TextProvider.
>> >
>> > Consider the object factory example, in this case guice :
>> >
>> > <struts>
>> >
>> > <bean type="com.opensymphony.xwork2.ObjectFactory"
>> > name="guice"
>> > class="com.google.inject.struts2.GuiceObjectFactory"/>
>> >
>> > <!-- Make the Guice object factory the automatic default -->
>> > <constant name="struts.objectFactory" value="guice" />
>> >
>> > </struts>
>> >
>> >
>> > What this does is create a bean provider with a given name of that
>> type.
>> >
>> > The constant portion is actually the configuration piece.
>> >
>> > I tried looking in the source, but I couldn't find how to configure the
>> > textProvider.
>> > The two pre-configured ones both use the same class so one wouldn't
>> note
>> > any difference.
>> >
>> > Maybe someone on the list can help you out more.
>> >
>> > Apologies,
>> > -a
>> >
>> >
>> >
>> > Igor Vlasov wrote:
>> >>
>> >> This action cause an error.
>> >> I will write in struts.xml:
>> >> <struts>
>> >>
>> >> <constant name="struts.enable.DynamicMethodInvocation"
>> value="false"
>> >> />
>> >>
>> >> <bean type="com.opensymphony.xwork2.TextProvider" name="xwork1"
>> >> class="karakas.struts.RicoTextProvider" />
>> >> <bean type="com.opensymphony.xwork2.TextProvider" name="struts"
>> >> class="karakas.struts.RicoTextProvider" />
>> >> <!-- Add packages here -->
>> >> .....
>> >> </struts>
>> >>
>> >> and use the same type(com.opensymphony.xwork2.TextProvider) and the
>> same
>> >> name(struts) as in struts-defailt.xml
>> >> Then i recieve an error in tomcat log:
>> >>
>> >>
>> >> Unable to load bean: type:com.opensymphony.xwork2.TextProvider
>> >> class:karakas.struts.RicoTextProvider - bean -
>> >> /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 -
>> >>
>> file:/D:/projects/Karakas1.1/build/web/WEB-INF/classes/struts.xml:10:109
>> >>
>> >>
>> >>
>> >>
>> >> cilquirm wrote:
>> >>>
>> >>> you can redefine it in your struts.xml, much like how you would
>> specify
>> >>> the object factory to override the default object factory .
>> >>>
>> >>> -a
>> >>>
>> >>>
>> >>>
>> >>> Igor Vlasov wrote:
>> >>>>
>> >>>> Hello.
>> >>>> I want to change some information in struts-default.xml.
>> >>>>
>> >>>> I can move it to classes directoty and do any change....:-)
>> >>>>
>> >>>> Is there any more sofisticated method to do the same from
>> struts.xml?
>> >>>>
>> >>>> For example i want to change TextProvider:
>> >>>> From
>> >>>> <bean type="com.opensymphony.xwork2.TextProvider" name="struts"
>> >>>> class="one class" />
>> >>>>
>> >>>> to
>> >>>> <bean type="com.opensymphony.xwork2.TextProvider" name="struts"
>> >>>> class="another class" />
>> >>>>
>> >>>
>> >>>
>> >>
>> >>
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-S2---Change-struts-default.xml-content-tf4684048.html#a13420988
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
--
View this message in context:
http://www.nabble.com/-S2---Change-struts-default.xml-content-tf4684048.html#a13421664
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]