[ http://issues.apache.org/struts/browse/WW-1018?page=comments#action_37890 ] Ted Husted commented on WW-1018: --------------------------------
Hmmm, I think we're blowing this issue off too easily. Unlike Struts 1, S2 ties the validation to the class hierarchy. The old ! syntax in the validation gave people a chance to work around that feature/restriction. A very common use case is that validation is different when a record is first saved versus when it is updated. For example, an update might require a key field, and a create might not. If we want to support the very popular notion of "dispatch actions", then we need a way to flex the validation for selected methods, because we will need more than one set of validations for a class. The only way I see to do that with S2 right now, is to use a dummy subclass. (The MailReader is doing this now.) But this sort of thing is just a kludge. We might need to find another way to specify validation on a per method basis. Or we need to accept creating dummy classes or dummy mappings to work around the lack of an elegant solution. -Ted. > validation problem for webwork's !command pattern action > -------------------------------------------------------- > > Key: WW-1018 > URL: http://issues.apache.org/struts/browse/WW-1018 > Project: Struts 2 > Issue Type: Bug > Components: Misc > Affects Versions: WW 2.2 > Environment: jdk:java 1.4.2 os:windows xp sp2 app server: tomcat > 5.0.28 > Reporter: jacky hua > Assigned To: Don Brown > > for webwork 2.1.7 we can use Action1Class-alias!method1-validation.xml to do > validation for Action's method1, > but for webwork 2.2 beta4 it does not work. > I went through the java sources of ww 2.1.7 and 2.2 beta, and found ww 2.2 > use ActionMapper for getting and storing > action's information instead of xwork's ConfigurationManager in ww 2.1.7 for > runtime. > and then ww 2.2 creates ActionProxy accroding to ActionMapper's information, > set method property to method1, > set action property to Action1, so destroies the information about action > invoked by !command pattern request. > and xwork's validation interceptor and validator have not done something to > fit this adjustment. > so I recommand to adjust xwork's ValidationInterceptor to do action's method > level validation, > e.g. we can use Action1Class-method1-validation.xml or > Action1Class-alias-method1-validation to do validation for a specific method. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
