Kawu
Kawu

Reputation: 14003

Mixing of @SessionScoped and @Model in CDI documentation

Java EE 6 newcomer question ahead, so beware...

I keep reading introductory CDI material like

http://docs.jboss.org/cdi/spec/1.0/html_single/#d0e268

I'm wondering throughout that document why they are mixing @SessionScoped with @Model, which is defined as being @RequestScoped plus @Named and a few other things I don't understand.

Why aren't the beans, e.g. the Login bean, simply annotated with @Named + @SessionScoped? What's the gain here?

Thanks

Upvotes: 2

Views: 577

Answers (1)

Antoine Sabot-Durand
Antoine Sabot-Durand

Reputation: 4980

You're right using @Named@SessionScoped`would achieve the same and would be clearer. In fact I wonder if some CDI impl couldn't throw an exception with this double scope (Weld doesn't).

BTW I encourage you to read Weld documentation which is a more concrete approach to CDI IMHO.

Upvotes: 2

Related Questions