java server faces (jsf ) next generation user interface

Click here to load reader

Upload: ilya

Post on 23-Feb-2016

60 views

Category:

Documents


0 download

DESCRIPTION

Java Server Faces (JSF ) Next Generation User Interface. Saif Kamaal. About Me. Masters in Computer Applciation from Mumbai University. Software developer for 3 years (2007) Java Web development since 2006 SCJP, SCWCD, Weblogic Certified. - PowerPoint PPT Presentation

TRANSCRIPT

Java Server Faces (JSF)

Saif KamaalJava Server Faces (JSF)Next Generation User Interface

About MeMasters in Computer Applciation from Mumbai University.Software developer for 3 years (2007)Java Web development since 2006SCJP, SCWCD, Weblogic Certified.Recent projects use JSF- Richfaces, Hibernate, JBoss, OracleWorking on Code Generation.

SummaryBrief History of JSF.Motivations for JSF, the Java Landscape.JSF details.Demo apps in JSF and Richfaces.

How UI Framework originated?Tradition applications were desktop applications based on AWT and then Swing.The origin of internet and increase in the number of clients gave rise to web based applications.Traditional web based applications were written in servlets (still a number of projects are based on servlets).Then came JSP and people said We have got what we always wanted no sooner they realized how wrong they were .Some technologies came here and went like light.

Application Developmenta Layered Approach

Why go for a Layered Approach ?strategic separation of different elements each layer is organized to provide support and base functionality to the nexteasier to solve multiple small problems than fewer big onesmitigates risk of technological evolutionvalue in consistency helps maintenance

A Common Layer Stack

Benefits of a Layered ApproachChange to a different Data Source with minimal effort - through Data Access LayerAdd new Deployment Options - e.g. Add a Web Services Layer over the Business Services LayerStorage & Data Structures are independent of the Presentation Layerand so on

Layer Deployments on TiersLayers reside on the same machine, same runtime and any object visible to one layer can be passed to the other either by Value or by Reference.

Tiers could be on different machines or on different runtimes, hence the data has to passed by Value only - as serialized objects.

Issues with ServletIn terms of creating a Grapical user interface,servlet is tough to use.Because you have to write huge code to send html text to client.No separation of concern. Java and HTML mix. Change in presentation part also required compiling the whole servlet.And the list goes on.

Sample Servlet Code

Issues with JSP JSP were created beacause complaints of developers like me and you who were tired of typing out.println("" + pageInfo.getTitle() + ""); into their servlet code.To solve the problem of separation of concerns but And so on..

Sample JSP Code

Saif KamaalEmirates Group ITEnters JSF Next Generation User Interface

What is Java Server Faces?JSF is a spec which defines a component-based MVC frameworkJSF 1.2 is included in the larger JEE5 specThe spec was developed by involving many people from orgs like Sun, Apache, IBM, OracleNot tied to a Web framework, nor a thick-client GUI theoretically could be applied to eitherImplementations, frameworks:Sun RI vs. Apache MyFacesJBoss Seam vs. Apache Struts 2 ShaleIBM, Oracle have proprietary solutions

The Problem with Web appsHTML? HTML? Java people like Objects, HTML is not ObjectsWeb programming is more difficult than GUI programmingJava programming is hard and J2EE is even more difficult: Servlets? JSP? EJBs!?! Microsoft has VisualStudio which turns web programming into drag-and-drop, that looks easy! 10 minute demo!

Answer: a Framework!(yet another framework, of course)Struts reduced lines of code, made apps pretty complex, created a niche of skilled Struts mercenariesWebWork fixed some of the Struts hassleSpringMVC brought powerful AOP concepts to web devTapestry JSP? dump it, XML rules!

MVC WARSany Web apps in 2006 means seeing a mix of Struts, Tapestry, Spring MVC, and Webwork (consultant: which one pays the best?)the battle rages on, who will win? how can you tell who won? Trust Craig? Trust Rod? How can a OSS project define victory?Converting legacy apps: Struts is dead! long live Struts 2 Action and Struts 2 Shale!!!How can I possibly pick one for a new project, when the technology is under attack?

JSF to the rescueMake Committees, Not War!get the big players together to solve MVC problems in a standard way, argue, compromise, repeat... publish final SpecUse components, not actions, more like Swing, less like StrutsSet a standard so we can build derivative products like IDEs with drag-n-drop ease, without worrying about change The differentiator that JSF brings, which other similar frameworks do not have, is the backing of a standard specification (JSR127). Because JSF is part of the J2EE standard specification, it is a top priority for every major J2EE tools vendor in the market (including Oracle, IBM, Borland, and Sun) to support it, which in turn will guarantee a wide adoptionand good tools support.and the main objective...

We will hit the target !!!!

3 Tier Application

MVC not again

How the two brothers are different?

How the JSF Specification Fits In

errr... Whats a component?the JSF spec defines a standard set of components and relationshipsthe View layer (e.g. JSP) and the Java code on the server use these components to interact and pass dataJSF tree is the current set of components in a Java object graphStruts, Webwork, SpringMVC use actions, not components

typical JSF component treeViewForminputcommandcomboinput

Enough of bla bla..some real action please Setup tools like Eclipse 3.5, Maven, 2.x, Tomcat/JBoss.Download the jsf jars.Additionally can use JBoss Tools.