You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2004/04/02 05:21:35 UTC
DO NOT REPLY [Bug 28150] New: -
Refactor ValidatorForm to facilitate overriding Validation Key
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: struts-dev@jakarta.apache.org
ReportedBy: niall.pemberton@blueyonder.co.uk
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: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org