Hi, I am developing my first Java Server Faces web application. I started learning Java some years ago and my Java knowledge is about book Core Java Vol 1 and most part of Vol. 2 by Cay Horstmann.
During this period of time I have learned the MVC approach to object oriented programming..
The web application I am developing is an application that allows users to upload a text file from a webpage. The server will load these words into a database, and then it will let the user modify those words from a webpage. Then it will let the user download the corrected file.
Basing on the knowledge I had, and probably making a mistake I started developing the server side part with a MVC approac. So all database functions, the controller, etc. Then I started to study how to implement the client side user interface.
Studying Java Server Faces on book Core Java Server Faces by Cay Horstmann, introduced me to the concept of Java Beans, a new (to me) approach to user-side user interface.
At this point I am a bit confused and I have some dubts between the classic Java application with MVC approach and the Java Bean of JSF approach.
In classic Java applications your software starts with the main function... It instantiates all main class objects like the controller, the exceptions handler class object, the class objects about the GUI, etc.
Instead, what about JSF? Where is the “birth” of the program execution? Where/Who is the controller of exceptions, user mistakes, etc???
This is not a "classic" java application, it is a web application. The application that has the main() is the actual container you're using (Tomcat, Glassfish, etc.). So that's where it all begins - you start your server, it will initialize itself and open up the possibility for you to deploy a web appication, which will then be made available to the outside world by the container through standard HTTP/HTTPS.
Perhaps before you dive into JSF you will want to review Java servlets which is the heart of a Java web environment. This free online book will explain it all:
You start your application server and the server starts various services and listeners, one of them being the http listener. It also accepts deployments (e.g a JSF-based web application). When a http request comes in to a web application on an URL path that has a JSF servlet registered (e.g. /faces/foo.xhtml), the JSF lifecycle takes over (http://www.ibm.com/developerworks/java/library/j-jsf2/index.html) the view is parsed, values are pulled from the model through EL expressions and the view is rendered. When you submit a value, again, stuff goes through the JSF lifecycle, is validates, values are applied to the model etc. There are plenty of tutorials to be found by googling but for a complete beginner I can understand it might be hard to get started. You might also want to consider a book on the topic.
With Java EE 6, the whole concept of the "Core EE patterns" is not that strict, I think. Sure, good patterns from the "Gang of Four" still applies but I don't see the use of DAOs and DTOs just because you have to. If need arises, extract stuff to interfaces, refactor. If you need alternative view layers, then you extract away the JSF imports to a separate bean etc.