Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF best practices

 
Peter Braun
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!

Do you know any book/article on JSF design and architecture? Some kind of design patterns or best practices about that how should I structure a JSF-based web application.

Thanks in advance,
Peter
 
Michal Glowacki
Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not exactly what you are looking for, but on this page you can find some useful articles:

http://www.jsftutorials.net/
 
Peter Braun
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!

Peter
 
Venkat Sadasivam
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can also look into below page for high level information.

http://venkatsadasivam.wordpress.com/2008/05/20/jsf-best-practices/
 
Peter Braun
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. The "Work around for some common issues" section is nice for me. I run into those issues. Maybe I'll try these workarounds if I'll have time.

But can you tell me about this? "Don�t create managed beans in session scope. Always create in request scope." Why do you recommend it?

P.
 
Venkat Sadasivam
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. It is not scalable solution. Assume 100 concurrent virtual user application, session objects will consume more heap memory. You will get out of memory exception after sometime.
2. For real time data application keep the data in session will affect the data accuracy.
3. In clustered/ load balancing environment, replicating session is costly operation.

keeping session object as lean good for scalable application.
 
Miguel�ngel Fern�ndez
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I was looking for an article on JSF best practices or architecture design and bumped into this thread. This conversation about not implementing session managed backing beans is interesting.

About the three reasons for not implementing session backing beans I would argue the following.

I'm currently developing an application where we've had to make a lot of use of session beans because it has to deal with a few workflows. Now, Here's what we are doing. Each interface is related to a corresponding request managed backing bean which stores objects of Collection<selectItem> to build the combos, HashMap<Integer, Boolean> for checkboxes, navigation methods for the buttons and other interface related elements. Now, when an interface needs to render a collection of objects for a search, the search criteria is handed by the request managed bean to a session managed bean which in turn querys the data base and stores the result in heap memory for further use. I this querying were done directly from the request managed backing bean you would loose the ability to keep the result for further use, thus producing the overhead of having to query the data base again and again with each new request. So, of course there is a trade off to only using request managed beans. I would say that if your request managed beans involve frequently used data base queries, you might want to take another look at session managed backing beans, specially if the queries are heavy (nested or sweeping a lot of data).

I don't really know if there is a better way to develop a jsf architecture. I'm currently doing a lot of research and trying to attempt variations of the former pattern.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic