Search code examples
javajsfmanaged-bean

JSF Managed Beans performance


I have a web page that has many forms. One for logging in, another for creating an article and another for submitting a comment. Now, each of these forms is backed by a different backing bean for instance: loggingBean, newCommentBean, etc. When the life cycle executes, does it create instances of each of these beans even though the user submitted only the "new comment" form?


Solution

  • It all depends on the scope of the beans. Request beans are created once per request but you probably shouldn't worry about the overhead of a bean creation, it's tiny. You should usually be more concerned with beans staying around too long (session beans that should be request beans) which needlessly drains memory.