javax.faces.view

Annotation Type ViewScoped


  • @NormalScope
     @Inherited
     @Documented
     @Target(value={TYPE,FIELD,METHOD})
     @Retention(value=RUNTIME)
    public @interface ViewScoped

    When this annotation, along with javax.inject.Named is found on a class, the runtime must place the bean in a CDI scope such that it remains active as long as NavigationHandler.handleNavigation(javax.faces.context.FacesContext, java.lang.String, java.lang.String) does not cause a navigation to a view with a viewId that is different than the viewId of the current view. Any injections and notifications required by CDI and the Java EE platform must occur as usual at the expected time.

    If ProjectStage is not ProjectStage.Production, verify that the current UIViewRoot does not have its transient property set to true. If so, add a FacesMessage for the current viewId to the FacesContext stating @ViewScoped beans cannot work if the view is marked as transient. Also log a Level.WARNING message to the log. If ProjectStage is ProjectStage.Production, do not do this verification.

    The bean must be stored in the map returned from UIViewRoot.getViewMap(boolean).

    Use of this annotation requires that any beans stored in view scope must be serializable and proxyable as defined in the CDI specification.

    The runtime must ensure that any methods on the bean annotated with PostConstruct or PreDestroy are called when the scope begins and ends, respectively. Two circumstances can cause the scope to end.

    • FacesContext.setViewRoot(javax.faces.component.UIViewRoot) is called with the new UIViewRoot being different than the current one.

    • The session, that happened to be active when the bean was created, expires. If no session existed when the bean was created, then this circumstance does not apply.

    In the session expiration case, the runtime must ensure that FacesContext.getCurrentInstance() returns a valid instance if it is called during the processing of the @PreDestroy annotated method. The set of methods on FacesContext that are valid to call in this circumstance is identical to those documented as "valid to call this method during application startup or shutdown". On the ExternalContext returned from that FacesContext, all of the methods documented as "valid to call this method during application startup or shutdown" are valid to call. In addition, the method ExternalContext.getSessionMap() is also valid to call.

    Since:
    2.2

Nederlandse vertaling

U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.

Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.

Bij voorbaat dank.

Document heeft de 11/06/2005 gemaakt, de laatste keer de 18/08/2025 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-javaee-rf-javax/faces/view/ViewScoped.html

De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.

Referenties

  1. Bekijk - html-document Taal van het document:fr Manuel PHP : https://docs.oracle.com, ViewScoped (Java(TM) EE 7 Specification APIs)

Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.