Take a basic example. In a servlet application, I would have the following classes:
- app.domain.User : domain or POJO model, will contain fields and getters / seters
- app.service.UserService : contains methods that work with user instances, for example
Register(User) . Would call DAO. - app.dao.UserDao : will be called by the service, in fact, say, insert the user into the database.
- app.servlets.RegisterController : the servlet intercepts requests from www.app/registration and calls methods in app.service.UserService. Then it will be redirected to
WEB-INF\JSPs\registration.jsp , which will take care of viewing.
All this made sense to me and clearly shared the problems.
I tried to wrap my head around JSF / Facelets thinking. I went through many excellent resources here in SO and other places, but there is no place that solves this simple question - namely, how the image of dao / service / controller / view is translated into JSF.
To continue my example, I created a JSF project in eclipse, transferred my database schema to "entities" , and now Iโm wondering: which package, with which king of classes should I create for user processing Registration? I understand that I need to create xhtml pages for presentation, but where is the controller?
Please do not point me to textbooks. I know many, including @BalusC one - my problem is not to do this work, but to understand the picture. I saw "session" packages containing "managed beans templates", "abstract facade", etc. Etc., But nothing makes as clear as the good old servlet template.
So, among the "entities" created by the database, there is a User.java class that looks like a model to me. The view will be xhtml. Controller?
NB: there are not so many duplicates of the differences between these technologies - I ask for a clear translation of the very clear and intuitive controller template / dao / service in the JSF structure - or a clear statement that there is no such translation.
See also:
source share