+ All Categories
Home > Documents > Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

Date post: 26-Dec-2015
Category:
Upload: augustine-little
View: 214 times
Download: 2 times
Share this document with a friend
Popular Tags:
24
Java Server Java Server Faces Faces St. Louis JavaSIG June 8, St. Louis JavaSIG June 8, 2006 2006 Jay Meyer, Jay Meyer, Harpoon Technologies Harpoon Technologies
Transcript
Page 1: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

Java Server FacesJava Server FacesSt. Louis JavaSIG June 8, St. Louis JavaSIG June 8,

20062006

Jay Meyer,Jay Meyer,

Harpoon TechnologiesHarpoon Technologies

Page 2: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

About MeAbout Me

Master CS from Washington Univ. Master CS from Washington Univ. (wustl.edu)(wustl.edu)

Software developer for 14 years (1992)Software developer for 14 years (1992) Java Web development since 1999Java Web development since 1999 Certified JBoss Application DeveloperCertified JBoss Application Developer Recent projects use Struts, Spring, Recent projects use Struts, Spring,

Hibernate, JBoss, OracleHibernate, JBoss, Oracle Hibernate consulting thru HarpoonTech, Hibernate consulting thru HarpoonTech,

a JBoss partnera JBoss partner

Page 3: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

SummarySummary

Brief History of JSFBrief History of JSF Motivations for JSF, the Java Motivations for JSF, the Java

LandscapeLandscape JSF detailsJSF details Demo apps in MyFaces & SeamDemo apps in MyFaces & Seam

Page 4: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

What is Java Server What is Java Server Faces?Faces?

JSF is a spec which defines a component-JSF is a spec which defines a component-based MVC frameworkbased MVC framework

JSF 1.2 is included in the larger JEE5 specJSF 1.2 is included in the larger JEE5 spec The spec was developed by involving many The spec was developed by involving many

people from orgs like Sun, Apache, IBM, people from orgs like Sun, Apache, IBM, OracleOracle

Not tied to a Web framework, nor a thick-Not tied to a Web framework, nor a thick-client GUI – theoretically could be applied to client GUI – theoretically could be applied to eithereither

Implementations, frameworks:Implementations, frameworks: Sun RI vs. Apache MyFacesSun RI vs. Apache MyFaces JBoss Seam vs. Apache Struts 2 ShaleJBoss Seam vs. Apache Struts 2 Shale IBM, Oracle have proprietary solutionsIBM, Oracle have proprietary solutions

Page 5: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

The Problem with Web appsThe Problem with Web apps

HTML? HTML? Java people like Objects, HTML HTML? HTML? Java people like Objects, HTML is not Objectsis not Objects

Web programming is more difficult than GUI Web programming is more difficult than GUI programmingprogramming

Java programming is hard – and J2EE is even Java programming is hard – and J2EE is even more difficult: Servlets? JSP? EJBs!?! more difficult: Servlets? JSP? EJBs!?!

Microsoft has VisualStudio which turns web Microsoft has VisualStudio which turns web programming into drag-and-drop, that looks programming into drag-and-drop, that looks easy! 10 minute demo!easy! 10 minute demo!

Page 6: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

Answer: a Framework!Answer: a Framework!(yet another framework, of course)(yet another framework, of course)

Struts – reduced lines of code, made Struts – reduced lines of code, made apps pretty complex, created a niche apps pretty complex, created a niche of skilled Struts mercenariesof skilled Struts mercenaries

WebWork – fixed some of the Struts WebWork – fixed some of the Struts hasslehassle

SpringMVC – brought powerful AOP SpringMVC – brought powerful AOP concepts to web devconcepts to web dev

Tapestry – JSP? dump it, XML rules!Tapestry – JSP? dump it, XML rules!

Page 7: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

MVC MVC WARSWARS

any Web apps in 2006 means seeing a mix of any Web apps in 2006 means seeing a mix of Struts, Tapestry, Spring MVC, and Webwork Struts, Tapestry, Spring MVC, and Webwork (consultant: which one pays the best?)(consultant: which one pays the best?)

the battle rages on, who will win? how can you the battle rages on, who will win? how can you tell who won? Trust Craig? Trust Rod? How tell who won? Trust Craig? Trust Rod? How can a OSS project define victory?can a OSS project define victory?

Converting legacy apps: Struts is dead! long Converting legacy apps: Struts is dead! long live Struts 2 Action and Struts 2 Shale!!!live Struts 2 Action and Struts 2 Shale!!!

How can I possibly pick one for a new project, How can I possibly pick one for a new project, when the technology is under attack?when the technology is under attack?

Page 8: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

JSF to the rescueJSF to the rescue Make Committees, Not War!Make Committees, Not War! get the get the bigbig players together to solve MVC players together to solve MVC

problems in a standard way, argue, problems in a standard way, argue, compromise, repeat... publish final Speccompromise, repeat... publish final Spec

Use components, not actions, more like Use components, not actions, more like Swing, less like StrutsSwing, less like Struts

Set a standard so we can build derivative Set a standard so we can build derivative products like IDEs with drag-n-drop ease, products like IDEs with drag-n-drop ease, without worrying about changewithout worrying about change

extensible standard to allow growth (plugins)extensible standard to allow growth (plugins) and the main objective...and the main objective...

Page 9: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.
Page 10: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

errr... What’s a component?errr... What’s a component?

the JSF spec defines a standard set of the JSF spec defines a standard set of components and relationshipscomponents and relationships

the View layer (e.g. JSP) and the Java the View layer (e.g. JSP) and the Java code on the server use these code on the server use these components to interact and pass datacomponents to interact and pass data

JSF tree is the current set of JSF tree is the current set of components in a Java object graphcomponents in a Java object graph

Struts, Webwork, SpringMVC use Struts, Webwork, SpringMVC use actions, not componentsactions, not components

Page 11: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

typical JSF component treetypical JSF component tree

View

Form

input

command

combo

input

Page 12: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

How does Apache MyFaces How does Apache MyFaces work?work?

jar file for deployment on Tomcat or jar file for deployment on Tomcat or any J2EE container – myfaces-all.jarany J2EE container – myfaces-all.jar

Controller servlet, XML config file, Controller servlet, XML config file, JSP, a pile of base classes, and JSP, a pile of base classes, and custom tags out the wazoo (of custom tags out the wazoo (of course! just like all the other course! just like all the other frameworks!)frameworks!)

Page 13: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

MyFaces architectureMyFaces architectureJ2EE server

Faces Servlet

base classes

faces-config.xml

my App

Page 14: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

MyFaces DemoMyFaces Demo

I used: Eclipse, Java5, JBoss 4 I used: Eclipse, Java5, JBoss 4 (JBossIDE)(JBossIDE)

Register a user Register a user the Bean: Registrationthe Bean: Registration the view : HTML and JSPthe view : HTML and JSP the Action Controllerthe Action Controller the web.xmlthe web.xml faces-config.xmlfaces-config.xml navigationnavigation

Page 15: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

What is Seam?What is Seam?

Seam is a new product from JBoss, (OSS, Seam is a new product from JBoss, (OSS, free as in beer and speech)free as in beer and speech)

Founded by Gavin King, Hibernate Founded by Gavin King, Hibernate creatorcreator

uses Java5 and EJB3 uses Java5 and EJB3 goal: use the exact same objects for goal: use the exact same objects for

persistence and rendering the view persistence and rendering the view layer: abolish glue code and DTO objectslayer: abolish glue code and DTO objects

combines MyFaces, EJB3combines MyFaces, EJB3

Page 16: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

Seam DemoSeam Demo

the Bean: User EJB3the Bean: User EJB3 the view : HTML and JSPthe view : HTML and JSP the Action: Register SSBthe Action: Register SSB Seam in the faces-config.xml?Seam in the faces-config.xml?

Page 17: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

Next for Seam?Next for Seam?

Reverse Engineering – make a whole Reverse Engineering – make a whole app from a set of database tablesapp from a set of database tables

Page 18: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

FaceletsFacelets

Totally replace JSPs, uses XHTML Totally replace JSPs, uses XHTML insteadinstead

Integrates tightly with JSF Integrates tightly with JSF faster and leaner than JSPs – same faster and leaner than JSPs – same

idea as Tapestryidea as Tapestry avoids serious JSP / JSF integration avoids serious JSP / JSF integration

issuesissues

Page 19: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

Seam architectureSeam architecture

Seam Framework

EJB3 Hibernate3

SQL DB

JSP Facelets

Sun JSF RIMyFaces

Page 20: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

TomahawkTomahawk

Apache’s extended JSF components, Apache’s extended JSF components, ships with MyFacesships with MyFaces

CalendarCalendar TreeTree advanced inputTextadvanced inputText

Page 21: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

the Futurethe Future

continued Component development, continued Component development, similar to taglib dev with Strutssimilar to taglib dev with Struts

more tool dev – Eclipse plugins, GUI more tool dev – Eclipse plugins, GUI designersdesigners

Facelets general acceptance instead of JSPFacelets general acceptance instead of JSP Seam innovation from Gavin King, JBoss Seam innovation from Gavin King, JBoss

also JSR 299 WebBeans just startedalso JSR 299 WebBeans just started Shale? Will Craig McClanahan work on Shale? Will Craig McClanahan work on

Shale or just Struts 2 Action (aka Shale or just Struts 2 Action (aka Webwork)Webwork)

Page 22: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

GlossaryGlossary JSF – JavaServer FacesJSF – JavaServer Faces JEE5 – the newest Java App Server spec, includes EJB3, JEE5 – the newest Java App Server spec, includes EJB3,

JSF etc.JSF etc. MyFaces – Apache’s JSF impl, completely replaces Sun’s MyFaces – Apache’s JSF impl, completely replaces Sun’s

ref impl for JSFref impl for JSF Tomahawk – Apache’s set of components to extend JSF, Tomahawk – Apache’s set of components to extend JSF,

comes with MyFacescomes with MyFaces Facelets – replacement for JSP, interprets XML instead of Facelets – replacement for JSP, interprets XML instead of

JSP files to produce web pages, integrated well with JSFJSP files to produce web pages, integrated well with JSF Seam – JBoss’ framework that works with JSF to provide Seam – JBoss’ framework that works with JSF to provide

the glue between JSF and EJB3 to reduce lines of code, the glue between JSF and EJB3 to reduce lines of code, includes MyFaces, Facelets (Gavin King’s project)includes MyFaces, Facelets (Gavin King’s project)

Shale – Apache Struts (Craig McClanahan) framework to Shale – Apache Struts (Craig McClanahan) framework to provide a better API for JSF, competes with Seam, needs provide a better API for JSF, competes with Seam, needs JDK5, not EJB3JDK5, not EJB3

Page 23: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

ResourcesResources

JavaServer Faces by Hans Bergsten, OReillyJavaServer Faces by Hans Bergsten, OReilly http://java.sun.com/javaee/javaserverfaces/http://java.sun.com/javaee/javaserverfaces/ http://www.coreservlets.com/JSF-Tutorial/http://www.coreservlets.com/JSF-Tutorial/ http://http://www.jboss.comwww.jboss.com/products/seam/products/seam http://docs.jboss.com/seam/reference/en/html/tutorial.htmlhttp://docs.jboss.com/seam/reference/en/html/tutorial.html http://struts.apache.org/struts-shale/index.htmlhttp://struts.apache.org/struts-shale/index.html http://www.jsfcentral.com/articles/facelets_1.htmlhttp://www.jsfcentral.com/articles/facelets_1.html

Page 24: Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies.

Questions?Questions?

contact: Jay Meyer contact: Jay Meyer [email protected]@harpoontech.com

discuss: Ideal architecture?discuss: Ideal architecture?

Facelets, MyFaces, Seam, EJB3, JBossAS, Facelets, MyFaces, Seam, EJB3, JBossAS, MySQL, Ubuntu Linux?MySQL, Ubuntu Linux?

discuss: worst of breed?discuss: worst of breed?

JSP, Struts 1.x, Sun JSF RI, Websphere, Toplink, JSP, Struts 1.x, Sun JSF RI, Websphere, Toplink, DB/2, WindowsDB/2, Windows


Recommended