Search code examples
jsf-2myfacescomposite-component

FacesComponent scope


What scope has a FacesComponent??.

Can i set something like ViewScope? SessionScope?

@FacesComponent(value="myComponent")
  public class MyComponent extends UINamingContainer  {
  }

Solution

  • No, you can't. It makes design technically also no sense.

    If you want to store some data in a certain scope, just explicitly store them in the desired scope yourself in one of the component's methods. The session scope for example is as a Map available by ExternalContext#getSessionMap().