1

Here is a question about how CDI works.

We have a model bean containing a String field, for example:

@Model
public class MyModel {
    private String a;

    public void setA(String s) {
        a = s;
    }        

    public String getA() {
        return a;
    }
}

And have a two JSF backing beans. First backing bean is a request scoped controller for login page, where MyModel instance is created and initialized after passing of authentication process. Second backing bean is a controller for session scoped component, which used in master page to display "a" field of injected MyModel instance. How inject the same instance of MyModel to second backing bean (JPA is not considered)? What is a best practices?

Thanks a lot.

Kukeltje
  • 12,223
  • 4
  • 24
  • 47
y3u
  • 11
  • 2

0 Answers0