@ManagedBean
registers a class instance as a managed bean, and then puts it in the use of one of the @ ... Within the range specified by the Scoped annotation. If no scope is specified, JSF puts the bean into the request scope, and if no name is specified, JSF converts the first letter of the class name to lowercase to form a managed bean name; For example, if the class name is UserBean, JSF creates a managed bean, Its name is Userbean. The eager and name properties are optional.
Note You must use a Java class that implements a zero-parameter constructor in combination. @ManagedProperty set a property for the managed bean. Annotations must be placed before the declaration of a class member variable. The Name property specifies the names of the attributes, which by default are the names of the member variables. The Value property is the values of the attribute, can be a string, or it can be a JSF expression, such as #{...}. @RequestScope Store managed beans within the scope of the request. @SessionScoped Store managed beans in session scope. @ApplicationScope store managed beans on an application-wide scale. @ViewScope Store managed beans in view scope. the @NoneScope Specifies that the managed bean has no scope. A managed bean with no scope is more useful when it is referenced by another bean. @CustomScope
store managed beans within a custom scope.
a custom scope is a map that can be accessed by the creator of the page. You can programmatically control the visibility and lifecycle of a bean within a custom scope. The Value property points to a map. @PostConstruct used after resource injection initialization @PreDestory for servlet detach service and release injected resources @ Resource is in a class or variable to "resource injection" of the servlet container. When the container recognizes this annotation, it implements the re-injection of the annotated variable with the appropriate value before obtaining the service status. By using this annotation, you do not have to use Jndi to find commands and manually declare resources in the configuration file Web.xml. The server performs its tasks through a servlet's self-regulation. The name and type of the variable are automatically determined by the imaging mechanism, although you can use the parameters of the annotation to override this limitation. An injected resource can be a data source, a Java Information service destination file, or a scalar that is set by the environment. @Resources for a set of @resource annotations