Package jakarta.mvc
Annotation Type Controller
-
@NameBinding @Target({METHOD,TYPE}) @Retention(RUNTIME) @Documented @Inherited public @interface Controller
Declares a method as a controller. If declared at the type level, it applies to all methods in the type.
A controller method that returns void is required to be annotated with
View
. A controller method can return a view path as aString
or aResponse
. If a controller returnsnull
and it is annotated withView
, then the value of this annotation is used as a default.Example:
@Controller public String sayHello() { return "hello.jsp"; }
- Since:
- 1.0
- Author:
- Santiago Pericas-Geertsen, Ivar Grimstad
- See Also:
View
,Response