• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSF + SFSB is best practice ?

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am asking about the separation of concerns in JSF application , Is it best practice to access service layer directly from action method or to use SFSB with CDI ?
 
Ranch Hand
Posts: 145
8
Mac MySQL Database Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In most cases, you need this:

JSF -> CDI (@SessionScoped or @ViewScoped) -> SSB (Stateless)-> whatever your business logic requires

Session with a SFSB was originally intended for non-HTTP remote clients (Applets and Swing applications).
In a way you could say it was the RMI equivalent of the HTTP session.

Both CDI and SFSB can store the state, but CDI is bound to the HTTP session and will get destroyed automatically when either the session terminates (for @SessionScoped) or view changes (for @ViewScoped),
whereas SFSB are open ended user-managed components, and their lifetieme must be managed by a client.

So in simple CRUD JSF-based web application, SFSB should probably not be used.
 
reply
    Bookmark Topic Watch Topic
  • New Topic