Java Server Faces(JSF) :
JSF is a highly productive MVC framework.Veiw's are designed to work like a reusable templates.Unlike the traditional page level request response JSF works at component level request response.It means a component can also make a request to the server.JSF also introduced the concept of event handling.The JSF event handling model is adopted from the Java Beans event handling model.In traditional event handling system both event generator and event handler resides on the same system where as in JSF event model the event handler resides in the server which is usually resides in a remote system so the event handling starts only after the request is submitted to the server.This is the main difference between the JSF event model and the traditional event model.
JSF is basically a specification.It can be implemented by any vendor/organization .That is the reason why we have multiple forms of JSF.My Faces is the JSF implementation from Apache.Like wise Rich Faces is the JSF implementation from JBOSS.IBM and Sun micro systems has its own JSF implementations. Important thing is each developer can use intermix of components.An IBM JSF developer can use intermix interested features of Apache My Faces or any other JSF implementations.
JSF view are reusable templates.Each view is managed by a baking mean also known as managed bean.The baking beans properties and member functions are made available to their views.That is a view can directly access its beans properties and member functions.
JSF also provides default or custom data validators & translaters. The developer can use a default vallidator or converter, or he/she can develop his/her validator and translater depending on the need.
The page navigation is defined by the navigation-rules and navigation cases. The developer has to mention his/her navigation rules and navigation cases in the faces-config.xml file.Each baking bean is also to be declared in the faces-config.xml file.The frame woke uses the faces-config.xml to configure the application.
In the bellow code sample I tried to explain the main features of the JSF.One more thing I want to mention here is, I used the same login registration system which I used for Struts and other code sample.Here my main intention is to show the core features of JSF and its application.
you can also see my clear separation of presentation layer, business layer and persistence layer.If you observed clearly I have used the same business and persistence layers,with out any changes,which used in my struts code sample.This is made possible because of perfect application BO and DAO patterns in my code samples.
Bellow is my code sample for JSF frame work.
First see the sample out puts.
Let us see the Code :
SignUp.jsp
|