-
@Retention(value=RUNTIME) @Target(value=TYPE) @Inherited public @interface ManagedBean
The presence of this annotation on a class automatically registers the class with the runtime as a managed bean class. Classes must be scanned for the presence of this annotation at application startup, before any requests have been serviced.
The value of the
name()
attribute is taken to be the managed-bean-name. If the value of the name attribute is unspecified or is the emptyString
, the managed-bean-name is derived from taking the unqualified class name portion of the fully qualified class name and converting the first character to lower case. For example, if theManagedBean
annotation is on a class with the fully qualified class namecom.foo.Bean
, and there is no name attribute on the annotation, the managed-bean-name is taken to bebean
. The fully qualified class name of the class to which this annotation is attached is taken to be the managed-bean-class.The scope of the managed bean is declared using one of
NoneScoped
,RequestScoped
,ViewScoped
,SessionScoped
,ApplicationScoped
, orCustomScoped
annotations. If the scope annotations are omitted, the bean must be handled as if theRequestScoped
annotation is present.If the value of the
eager()
attribute istrue
, and themanaged-bean-scope
value is "application", the runtime must instantiate this class when the application starts. This instantiation and storing of the instance must happen before any requests are serviced. If eager is unspecified orfalse
, or themanaged-bean-scope
is something other than "application", the default "lazy" instantiation and scoped storage of the managed bean happens.When the runtime processes this annotation, if a managed bean exists whose name is equal to the derived managed-bean-name, a
FacesException
must be thrown and the application must not be placed in service.A class tagged with this annotation must have a public zero-argument constructor. If such a constructor is not defined on the class, a
FacesException
must be thrown and the application must not be placed in service.- Since:
- 2.0
-
-
Element Detail
-
name
public abstract String name
Taken to be the
managed-bean-name
. See class documentation for details.- Default:
- ""
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 18/08/2025
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-javaee-rf-javax/faces/bean/ManagedBean.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.