@NameBinding @Target(value={METHOD,TYPE}) @Retention(value=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 a String
or as part of a Viewable
or a
Response
. If a controller returns null
and it is
annotated with View
, then the value of this
annotation is used as a default. If a controller method returns a
different Java type, its toString
is called and the result
interpreted as a view path.
Example:
@Controller
public String sayHello() {
return "hello.jsp";
}
Copyright © 2015 Oracle Corporation. All rights reserved.