Jsf 2.0 Overview

1,516 views
1,420 views

Published on

Published in: Education, Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
1,516
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
40
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Jsf 2.0 Overview

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

×