Download presentation
Presentation is loading. Please wait.
Published byAugustine Little Modified over 9 years ago
1
Java Server Faces St. Louis JavaSIG June 8, 2006 Jay Meyer, Harpoon Technologies
2
About Me Master CS from Washington Univ. (wustl.edu) Master CS from Washington Univ. (wustl.edu) Software developer for 14 years (1992) Software developer for 14 years (1992) Java Web development since 1999 Java Web development since 1999 Certified JBoss Application Developer Certified JBoss Application Developer Recent projects use Struts, Spring, Hibernate, JBoss, Oracle Recent projects use Struts, Spring, Hibernate, JBoss, Oracle Hibernate consulting thru HarpoonTech, a JBoss partner Hibernate consulting thru HarpoonTech, a JBoss partner
3
Summary Brief History of JSF Brief History of JSF Motivations for JSF, the Java Landscape Motivations for JSF, the Java Landscape JSF details JSF details Demo apps in MyFaces & Seam Demo apps in MyFaces & Seam
4
What is Java Server Faces? JSF is a spec which defines a component-based MVC framework JSF is a spec which defines a component-based MVC framework JSF 1.2 is included in the larger JEE5 spec JSF 1.2 is included in the larger JEE5 spec The spec was developed by involving many people from orgs like Sun, Apache, IBM, Oracle The spec was developed by involving many people from orgs like Sun, Apache, IBM, Oracle Not tied to a Web framework, nor a thick-client GUI – theoretically could be applied to either Not tied to a Web framework, nor a thick-client GUI – theoretically could be applied to either Implementations, frameworks: Implementations, frameworks: Sun RI vs. Apache MyFaces Sun RI vs. Apache MyFaces JBoss Seam vs. Apache Struts 2 Shale JBoss Seam vs. Apache Struts 2 Shale IBM, Oracle have proprietary solutions IBM, Oracle have proprietary solutions
5
The Problem with Web apps HTML? HTML? Java people like Objects, HTML is not Objects HTML? HTML? Java people like Objects, HTML is not Objects Web programming is more difficult than GUI programming Web programming is more difficult than GUI programming Java programming is hard – and J2EE is even more difficult: Servlets? JSP? EJBs!?! Java 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! Microsoft has VisualStudio which turns web programming into drag-and-drop, that looks easy! 10 minute demo!
6
Answer: a Framework! (yet another framework, of course) Struts – reduced lines of code, made apps pretty complex, created a niche of skilled Struts mercenaries Struts – reduced lines of code, made apps pretty complex, created a niche of skilled Struts mercenaries WebWork – fixed some of the Struts hassle WebWork – fixed some of the Struts hassle SpringMVC – brought powerful AOP concepts to web dev SpringMVC – brought powerful AOP concepts to web dev Tapestry – JSP? dump it, XML rules! Tapestry – JSP? dump it, XML rules!
7
MVC WARS any Web apps in 2006 means seeing a mix of Struts, Tapestry, Spring MVC, and Webwork (consultant: which one pays the best?) any 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? 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!!! 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? How can I possibly pick one for a new project, when the technology is under attack?
8
JSF to the rescue Make Committees, Not War! Make Committees, Not War! get the big players together to solve MVC problems in a standard way, argue, compromise, repeat... publish final Spec get the big players together to solve MVC problems in a standard way, argue, compromise, repeat... publish final Spec Use components, not actions, more like Swing, less like Struts Use components, not actions, more like Swing, less like Struts Set a standard so we can build derivative products like IDEs with drag-n-drop ease, without worrying about change Set a standard so we can build derivative products like IDEs with drag-n-drop ease, without worrying about change extensible standard to allow growth (plugins) extensible standard to allow growth (plugins) and the main objective... and the main objective...
10
errr... What’s a component? the JSF spec defines a standard set of components and relationships the JSF spec defines a standard set of components and relationships the View layer (e.g. JSP) and the Java code on the server use these components to interact and pass data the View layer (e.g. JSP) and the Java code on the server use these components to interact and pass data JSF tree is the current set of components in a Java object graph JSF tree is the current set of components in a Java object graph Struts, Webwork, SpringMVC use actions, not components Struts, Webwork, SpringMVC use actions, not components
11
typical JSF component tree View Form input command combo input
12
How does Apache MyFaces work? jar file for deployment on Tomcat or any J2EE container – myfaces-all.jar jar file for deployment on Tomcat or any J2EE container – myfaces-all.jar Controller servlet, XML config file, JSP, a pile of base classes, and custom tags out the wazoo (of course! just like all the other frameworks!) Controller servlet, XML config file, JSP, a pile of base classes, and custom tags out the wazoo (of course! just like all the other frameworks!)
13
MyFaces architecture J2EE server Faces Servlet base classes faces-config.xml my App
14
MyFaces Demo I used: Eclipse, Java5, JBoss 4 (JBossIDE) I used: Eclipse, Java5, JBoss 4 (JBossIDE) Register a user Register a user the Bean: Registration the Bean: Registration the view : HTML and JSP the view : HTML and JSP the Action Controller the Action Controller the web.xml the web.xml faces-config.xml faces-config.xml navigation navigation
15
What is Seam? Seam is a new product from JBoss, (OSS, free as in beer and speech) Seam is a new product from JBoss, (OSS, free as in beer and speech) Founded by Gavin King, Hibernate creator Founded by Gavin King, Hibernate creator uses Java5 and EJB3 uses Java5 and EJB3 goal: use the exact same objects for persistence and rendering the view layer: abolish glue code and DTO objects goal: use the exact same objects for persistence and rendering the view layer: abolish glue code and DTO objects combines MyFaces, EJB3 combines MyFaces, EJB3
16
Seam Demo the Bean: User EJB3 the Bean: User EJB3 the view : HTML and JSP the view : HTML and JSP the Action: Register SSB the Action: Register SSB Seam in the faces-config.xml? Seam in the faces-config.xml?
17
Next for Seam? Reverse Engineering – make a whole app from a set of database tables Reverse Engineering – make a whole app from a set of database tables
18
Facelets Totally replace JSPs, uses XHTML instead Totally replace JSPs, uses XHTML instead Integrates tightly with JSF Integrates tightly with JSF faster and leaner than JSPs – same idea as Tapestry faster and leaner than JSPs – same idea as Tapestry avoids serious JSP / JSF integration issues avoids serious JSP / JSF integration issues
19
Seam architecture Seam Framework EJB3 Hibernate3 SQL DB JSPFacelets Sun JSF RIMyFaces
20
Tomahawk Apache’s extended JSF components, ships with MyFaces Apache’s extended JSF components, ships with MyFaces Calendar Calendar Tree Tree advanced inputText advanced inputText
21
the Future continued Component development, similar to taglib dev with Struts continued Component development, similar to taglib dev with Struts more tool dev – Eclipse plugins, GUI designers more tool dev – Eclipse plugins, GUI designers Facelets general acceptance instead of JSP Facelets general acceptance instead of JSP Seam innovation from Gavin King, JBoss also JSR 299 WebBeans just started Seam innovation from Gavin King, JBoss also JSR 299 WebBeans just started Shale? Will Craig McClanahan work on Shale or just Struts 2 Action (aka Webwork) Shale? Will Craig McClanahan work on Shale or just Struts 2 Action (aka Webwork)
22
Glossary JSF – JavaServer Faces JSF – JavaServer Faces JEE5 – the newest Java App Server spec, includes EJB3, JSF etc. JEE5 – the newest Java App Server spec, includes EJB3, JSF etc. MyFaces – Apache’s JSF impl, completely replaces Sun’s ref impl for JSF MyFaces – Apache’s JSF impl, completely replaces Sun’s ref impl for JSF Tomahawk – Apache’s set of components to extend JSF, comes with MyFaces Tomahawk – Apache’s set of components to extend JSF, comes with MyFaces Facelets – replacement for JSP, interprets XML instead of JSP files to produce web pages, integrated well with JSF Facelets – replacement for JSP, interprets XML instead of JSP files to produce web pages, integrated well with JSF Seam – JBoss’ framework that works with JSF to provide the glue between JSF and EJB3 to reduce lines of code, includes MyFaces, Facelets (Gavin King’s project) Seam – JBoss’ framework that works with JSF to provide the glue between JSF and EJB3 to reduce lines of code, includes MyFaces, Facelets (Gavin King’s project) Shale – Apache Struts (Craig McClanahan) framework to provide a better API for JSF, competes with Seam, needs JDK5, not EJB3 Shale – Apache Struts (Craig McClanahan) framework to provide a better API for JSF, competes with Seam, needs JDK5, not EJB3
23
Resources JavaServer Faces by Hans Bergsten, OReilly JavaServer Faces by Hans Bergsten, OReilly http://java.sun.com/javaee/javaserverfaces/ 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://www.coreservlets.com/JSF-Tutorial/ http://www.jboss.com/products/seam http://www.jboss.com/products/seam http://www.jboss.com/products/seam http://docs.jboss.com/seam/reference/en/html/tutorial.html http://docs.jboss.com/seam/reference/en/html/tutorial.html http://docs.jboss.com/seam/reference/en/html/tutorial.html http://struts.apache.org/struts-shale/index.html http://struts.apache.org/struts-shale/index.html http://struts.apache.org/struts-shale/index.html http://www.jsfcentral.com/articles/facelets_1.html http://www.jsfcentral.com/articles/facelets_1.html http://www.jsfcentral.com/articles/facelets_1.html
24
Questions? contact: Jay Meyer jmeyer@harpoontech.com jmeyer@harpoontech.com discuss: Ideal architecture? Facelets, MyFaces, Seam, EJB3, JBossAS, MySQL, Ubuntu Linux? discuss: worst of breed? JSP, Struts 1.x, Sun JSF RI, Websphere, Toplink, DB/2, Windows
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.