You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Rikard Swahn (JIRA)" <ji...@apache.org> on 2010/11/23 10:10:14 UTC

[jira] Updated: (WW-3533) Using @VisitorFieldValidator loses TextProvider from action

     [ https://issues.apache.org/jira/browse/WW-3533?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rikard Swahn updated WW-3533:
-----------------------------

    Attachment: VisitorFieldValidator.patch

> Using @VisitorFieldValidator loses TextProvider from action
> -----------------------------------------------------------
>
>                 Key: WW-3533
>                 URL: https://issues.apache.org/jira/browse/WW-3533
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: 2.2.1
>         Environment: Tomcat6 + WindowsXP + Spring + Convention Plugin
>            Reporter: Rikard Swahn
>         Attachments: VisitorFieldValidator.patch
>
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> I'm validating form data posted to a modeldriven action, with @VisitorFieldValidator applied to the getModel() method. In the object returned by getModel(), I have for example @RequiredStringValidator(key="property") on a set method. When adding an error and resolving the property, the TextProvider from the action is not used, but instead, Struts 2 attempts to resolve the property via the visited object, which fails.
> I think have found the problem. In DelegatingValidatorContext.makeTextProvider(Object object, LocaleProvider localeProvider), the method expects object to be the action instance, but in VisitorFieldValidator, makeTextProvider is called with the visitor object instead of the action instance. If called with action instance, property resolving works.
> I saw the same problem in an old issue, but then XML validation was used:
> http://jira.opensymphony.com/browse/XW-501
> Patch included.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.