@Retention(value=RUNTIME) @Target(value=METHOD) public @interface BeforeAction
A method annotated with this annotation is invoked before the @Action
method is invoked. There can be only one method with this annotation in a
controller or interceptor. A @BeforeAction method must accept no
arguments, or accept only a RequestContext
argument. Methods annotated with this annotation must not be annotated with
@Action, @DefaultAction, or @InterceptedBy. A
@BeforeAction method must be public.
A @BeforeAction method can return any return type, but only a
View
return type will have any significance. If a
concrete View is returned, the @Action method is not invoked. However,
if a null View is returned, or the method return type is void, then the
@Action method is called.
The following are valid uses of this annotation:
@BeforeAction public View doSomethingBefore() { return new View("before.jsp"); }
@BeforeAction public View doSomethingBefore() { return null; // keep going on to the @Action method }
@BeforeAction public void doSomethingBefore() { // do something before and keep going on to the @Action method }
A @BeforeAction method can be used either in a controller or in an
interceptor class. For more information about interceptors, see
InterceptedBy
.
Copyright © 2011-2012 MojaveMVC.org