Issue Details (XML | Word | Printable)

Key: SPR-4774
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Juergen Hoeller
Reporter: David Pedowitz
Votes: 4
Watchers: 4
Operations

If you were logged in you would be able to see more operations.
Spring Framework

@Validator, @Validate

Created: 02/May/08 11:31 PM   Updated: 06/Aug/08 03:01 PM
Component/s: SpringWEB
Affects Version/s: None
Fix Version/s: 3.0 M2

Time Tracking:
Not Specified


 Description  « Hide
More brainstorming from training session in LA, 5/1/08 with Chris Beams, Tchavdar Ivanov (FIM) and myself.

@Validator could be a class level annotation eligible for component scans, the methods of which could be annotated with @Validate (or similar) which would enable method/request param specific validation within the request handling workflow
- Like the @HandlerInterceptor design (SPR-4770) @Validator could take a list of @Controller classes for a more fine grained approach or @Controller could take a list of @Validator which would match the current register model (I think I like the later)
 
@Validate would define a method used to validate an @RequestParam, it'd might be neat if it handled superset of @RequestParam and @RequestMapping arguments for a very fine grained approach, i.e. @Validate("reward", method=RequestMethod.POST).
- Another option would be to register the Validator with the @RequestParam

Hope you dig the ideas

 All   Comments   Work Log   Change History   FishEye   Builds      Sort Order: Ascending order - Click to sort in descending order
Keith Donald added a comment - 06/Aug/08 12:51 PM
The most basic feature we can provide is the ability to detect that a form object like an AccountForm should be validated. A simple way to detect would be the AccountForm has a validate method on it, or the AccountForm has constraints specified as annotations e.g. @Required or @Length. Alternatively, a validation system could contain some mapping between an AccountForm and a set of declarative validation constraints.