> > when an application uses a custom TextProvider it seems not to be used for > > validation errors. And if an Action is ModelDriven it behaves different > > again. > > > > Here is a sample app for that: > > https://github.com/wolpi/struts2-samples/tree/master/modeldriven- > and-textprovider > > > > > > This sample has these Objects on ValueStack: > > - Model > > - CustomTextProvider > > - Action > > - DefaultTextProvider > > > > In hello.jsp three texts are shown: > > - Just a normal text via <s:text>. That text is resolved via > > CustomTextProvider (as expected). > > - A validation error of an action member. That text is resolved via the > > action itself, what I would not expect. > > - A validation error of a model member. That text is tried to be resolved > > via DefaultTextProvider, what I would not expect either. > > > > > > Am I doing something wrong here? > > Have you tried to use the extension point: struts.xworkTextProvider ? > > http://struts.apache.org/development/2.x/docs/plugins.html#Plugins- > ExtensionPoints > >
that changed things, but it is still not used for ModelDriven validation errors. Here is what I have done: - Registered CustomTextProvider in struts.xml: <bean name="customTextProvider" scope="default" type="com.opensymphony.xwork2.TextProvider" class= "struts2.samples.modeldrivenandtextprovider.actions.CustomTextProvider" /> <constant name="struts.xworkTextProvider" value="customTextProvider" /> - Removed it from ValueStack - Removed TextProvider methods from action (see git history) This gave: - CustomTextProvider is used for <s:text> - CustomTextProvider is used for validaton errors of action members - CustomTextProvider is not used for validaton errors of model members Regards, Christoph This Email was scanned by Sophos Anti Virus