Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to code business logic in JSF  RSS feed

 
Murali Mohan Atmakuri
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am very new to JSF.
I had developed a small web application that navigates from login page to a home page and here i want something like a search functionality.

My question is where does the business logic (Model part) go in? Navigation rules in faces-config.xml defines navigation between views but before this i want some business logic to be coded. (where does JSF have something similar to Action classes in Struts.?)

-Murali
 
Tim Holloway
Bartender
Posts: 18709
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the backing bean or a delegate thereof. In JSF, backing beans provide both the functions of Struts Form Beans and Struts Action Processors, although the JSF actions tend to be less complex, in my experience.

That's one reason why one of the primary architects of Struts jumped over to JSF. It takes about 4 Struts classes to do the work of one JSF backing bean class, and the backing bean is a POJO, so it doesn't require a complex framework to test it.

Major business logic (say, anything more than 10 lines) should not go in the backing bean. For that matter, the same rule applies to Struts Actions. If the logic is complex, have the JSF action hand it off to a business logic bean.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!