DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=28150>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=28150

Refactor ValidatorForm to facilitate overriding Validation Key

           Summary: Refactor ValidatorForm to facilitate overriding
                    Validation Key
           Product: Struts
           Version: Nightly Build
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Validator Framework
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


Currently if you want to pass a different key into the validator other than the 
form name (using ValidatorForm) or action path (using ValidatorActionForm) then 
you have to override the validate() method and duplicate the code.

I have refactored ValidatorForm and DynaValidatorForm to add a new 
getValidationKey() method so that it makes overriding the default behaviour 
much simpler. The method in ValidatorForm looks like this:

public String getValidationKey(ActionMapping mapping,
                               HttpServletRequest request) {

       return mapping.getAttribute();
}


I have also refactored ValidatorActionForm and DynaValidatorActionForm to use 
this method - code duplicated in these classes has been removed and they are 
now much simpler and obvious what they do.


I would like this change, but it has also come up on the user list recently a 
couple of times - there was a discusison last week about how to have different 
validations called when using the LookupDispatchAction. This change makes that 
sort of thing more straight forward.

Niall

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to