Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

struts has action class - anything similar in jsf  RSS feed

 
anagha desai
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
New to JSF

Have some amount of experience in Struts
So inevitably I am comparing the two .

So one thing I dont understand is ::
In struts we have action classes through which we start talking to the model

In JSF looks like the UI is bound to the bean ( to populate data from UI )
( Similar to the ActionForm from struts ? )

However where is the clean handoff to model in JSF ( the way struts hands off control from action class ? )

Regards,
-anagha
 
Tim Holloway
Bartender
Posts: 18661
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There isn't one. The action methods are also part of the backing beans. You're trading the OO "purity" of keeping data and functions separate in exchange for reducing the total number of classes. Backing beans are a facade for the business layer, however, not intended to be primary data objects in their own right.

Struts offends in the opposite direction. I've seen people try to make a single action class handle both the presentation and preservation phases of acting on business objects. Since Struts really wasn't designed for that, the results have often been confusing and complex.

Neither solution is ideal. However I do find it easier to deal with the JSF concept that everything's in one place and that the workflow is easier (for me) to follow. Also, there's not the issue of ignorant programmers attempting to use member variables to store things in violation of thread safety that I've encountered in Struts. In JSF, the bean's threading characteristics are more obvious. For one thing, it doesn't attempt to use a single instance by default.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!