Did you substitute your custom provider in the xml declaration?
The default from struts-default.xml is:
<bean type="com.opensymphony.xwork2.TextProvider" name="struts"
class="...TextProviderSupport" />
so you will need to plug your implementation.
Peace,
Scott
ayavorskiy wrote:
>
> Hi,
> Is there a way to substitute default, bundle-based TextProvider in Struts
> 2 with a custom one?
>
> We have a very custom message resolution needs with our Struts 2 based
> application. Per other posts and explanation from "Struts In Action",
> overriding of all getText methods in the base Action class does the trick
> for 90% of what we need. However, there is an issue around "Visitor
> validator" that apparently goes through a different path for error string
> resolution and does not call getText() methods on the action.
>
> Apparently, when model-driven Action design is used and <my
> model>-validation.xml is stored next to the model class, error messages
> (<message key="..." ../>) defined in validation XML get routed to the
> default TextProvider.
>
> Is there a way to plug in a custom Text Provider, system-wide? The
> TextProviderFactory makes it seem like custom provider is "injectable"
> (see below), but I have not been able to get it to ever "inject" anything.
> Seems like it always creates a new instance of TextProviderSupport()
> behind the scenes.
>
> Any help is much appreciated!!!
>
> 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;
> }
> }
>
>
>
--
View this message in context:
http://www.nabble.com/Stuts-2-and-Custom-TextProvider-tp18658000p18754686.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]