This question already has an answer here:
I am studying JavaEE and I got confused with JSF architecture and how it fits the JavaEE architecture.
I had a JavaEE crash course at work and they told us that the standard JavaEE architecture is a service based with anemic models (assumption 1) (explained better in this question I asked).
I am reading Beginning JavaEE7 book, which is very nice. First he explains the MVC pattern (page 349) and says: "In MVC, the model represents the data of the application (assumption 2), the view corresponds to the UI and the controller manages the communication between both".
In the JSF chapter the writer explains that in the MVC pattern, the FacesServlet is the controller, the XHTML page is the View and the Backing Bean (aka [JSF] Managed Bean) is the model (assumption 3).
Until now everything makes sense.
-
But in the example Listint 11-11, the backing bean is called BookController. if it is a model, why is it called controller? It would break assumption 3
-
In page 354, section "Writing Backing Beans", he writes "Backing Beans are annotated Java classes and are central to web applications. They can perform business logic (or delegate to EJBs)...". As far as I understood his explanation of MVC, the model should only contain the data, not handle it. This would break assumption 2
-
Outside the scope of the book, I find a mismatch about JSF's architecture and JavaEE architecture: It seems that the concept of backing beans is much closer to the rails approach using rich a rich business model (where there would not be a service layer, but the model would be rich and contain the business logic) than the Java service architecture. Meaning the backing bean would represent be the model with the business logic, and not work as a controller that would delegate the execution to a service layer. This would break assumption 1.
I think these contradictions are due a poor understanding of the architecture and how the components fit together. Could you please clarify these points for me?
Aucun commentaire:
Enregistrer un commentaire