title: How does Servlet/JSP MVC patterns translate to JSF/Facelets (in particular the service and controller parts)?
body: <p>Let us take a basic example. In a servlet app I would have those classes:</p>
  
  <ul>
  <li><strong>app.domain.User</strong>: domain or model POJO, would contain fields and getters/setters</li>
  <li><strong>app.service.UserService</strong>: would contain methods that operate on User instances, such as <code>Register(User)</code>. Would call the DAO.</li>
  <li><strong>app.dao.UserDao</strong>: would be called by service to actually, say, insert a User in the DB.</li>
  <li><strong>app.servlets.RegisterController</strong>: a servlet intercepting requests to www.app/registration and calling the methods in app.service.UserService. It would then redirect to <code>WEB-INF\JSPs\registration.jsp</code> which would take care of the view.</li>
  </ul>
  
  <p>All this made perfect sense to me and clearly separated the concerns.</p>
  
  <p>I have tried since to wrap my head around the JSF/Facelets way of thinking. I have went through many excellent resources here in SO and otherplaces but there is not any place that addresses this simple question - namely <em>how does the dao/service/controller/view pattern</em> translate into JSF.</p>
  
  <p>To continue my example - I have set up a JSF project in eclipse, have translated my DB schema to <code>"entities"</code> and now I am left wondering - what kind of package, with what king of classes should I create to handle user Registration ? I understand I have to create xhtml pages for the view but where is the controller ?</p>
  
  <p>Please do not point me to tutorials - I am aware of many, amongst which the <a href="http://balusc.blogspot.gr/2011/01/jsf-20-tutorial-with-eclipse-and.html" rel="nofollow noreferrer">@BalusC one</a> - my problem is not to make this work but to understand the pattern. I have seen "session" packages containing "managed beans", "abstract facade" patterns etc etc but nothing that makes as clear sense as the good old servlets pattern.</p>
  
  <p>So - among the "entities" created by the DB there is a User.java class that looks like the model to me. The view will be an xhtml. The controller ?</p>
  
  <p>NB: this is not asking as so many duplicates here the differences between those technologies - I am asking about a clear translation of the very clear and intuitive controller/dao/service pattern to the JSF framework - or a clear statement that there is not such a translation.</p>
  
  <p>See also:</p>
  
  <ul>
  <li><a href="https://netbeans.org/kb/docs/javaee/ecommerce/design.html" rel="nofollow noreferrer">The NetBeans E-commerce Tutorial</a> - bit outdated, actually uses JSP (!)</li>
  <li><a href="http://programming.manessinger.com/tutorials/an-eclipse-glassfish-java-ee-6-tutorial/" rel="nofollow noreferrer">An Eclipse / GlassFish / Java EE 6 Tutorial</a> actually uses Servlets (!) but at least is eclipse based</li>
  <li><a href="http://balusc.blogspot.gr/2011/01/jsf-20-tutorial-with-eclipse-and.html" rel="nofollow noreferrer">JSF 2.0 tutorial with Eclipse and Glassfish</a> the BalusC one I referred to</li>
  <li>A <a href="https://github.com/Utumno/ted2012" rel="nofollow noreferrer">school project</a> featuring the servlet pattern and <a href="https://www.assembla.com/code/kraken2012/git/commits" rel="nofollow noreferrer">another bigger one</a> with CDI</li>
  <li><a href="https://stackoverflow.com/questions/10111387/understanding-jsf-as-a-mvc-framework/10114158#10114158">Understanding JSF as a MVC framework</a></li>
  </ul>