|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ValidationErrorHandler
Interface that can be implemented by ActionBeans to be notified of ValidationErrors that occur during validation and binding. In the case where an ActionBean does not implement this interface, the errors are marshalled, the user is returned to the page from which they came and the ActionBean instance is discarded.
Implementing this interface gives ActionBeans the chance to modify what happens when the
binding and/or validation phase(s) generate errors. The handleValidationErrors method is
invoked after all validation has completed - i.e. after annotation based validation and any
ValidationMethod
s that are applicable for the current request. Invocation only happens
when one or more validation errors exist. Also, note that setContext()
will always have
been invoked prior to handleValidationErrors(ValidationErrors)
, allowing the bean
access to the event name and other information.
When the handleValidationErrors(ValidationErrors)
method is invoked, the
ActionBean
may do one or more of the following:
For example, if you want to override the validation service's results and continue
execution, you might invoke errors.clear()
to remove all the errors. Doing this makes it
as though the errors had never been generated! Or perhaps for a specific ActionBean you'd
like to redirect to a different error page instead of the page the user came from, in that
case you can simply return a new ForwardResolution
or
RedirectResolution
to change where the user will be sent.
Returning a Resolution
from this method is stricly optional. If a Resolution is
returned it will be executed instead of the error resolution. If null is returned (and one
or more errors persist) then the error resolution will be executed as normal.
Method Summary | |
---|---|
Resolution |
handleValidationErrors(ValidationErrors errors)
Allows the ActionBean to influence what happens when validation errors occur during validation and binding. |
Method Detail |
---|
Resolution handleValidationErrors(ValidationErrors errors) throws Exception
errors
- the set of validation errors generated during validation and binding
Exception
- may throw any exception, but this will generally result in a
ServletException being thrown on up the stack
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |