Provides a modern 2011 look on the state of Web Development on Java platform.
Covers framework classification, main features of each framework, how to select a framework and modern tools usage for Java web development
2. Agenda Web frameworks classification Major frameworks in each class How to select a framework and typical combinations Rapid web development on Java Modern approaches to development 2
3. Web Frameworks Classification Web Frameworks can be classified into following categories: Request/Action Frameworks (Spring MVC, Struts 2, …) Component Frameworks (GWT, JSF, …) Server Side Frameworks (BlazeDS, Jax-RS, …) 3
4. Request/Action Frameworks Follows classic MVC pattern No notion of component Reusability of controllers and views Have similar structure and concepts Simple and straightforward Better suited for simple sites Examples: Spring MVC, Struts 2 Non Java examples: Ruby on Rails, ASP.NET MVC 4
5. Component Frameworks Have components at its core Better suited for RIA applications and Forms applications More complex Examples: GWT, JSF, Tapestry 5 Non Java examples: ASP.NET 5
6. Server Side Frameworks Divided into following groups: Web Services (SOAP and RESTful) Flex Server Side Ajax libraries, Serialization/Marshaling libraries 6
7. Web Services SOAP based Frameworks: Axis 1/2, Spring WS, JAX-WS XML based RESTful (Jax-RS, Spring MVC, …): Frameworks: Follows REST guidelines XML, JSON or other protocol 7
8. Flex Main frameworks: BlazeDS, WebORB, Granite DS, LiveCycle Data Services Provide serialization for AMF protocol Some have code generation Java is first class citizen in Flex world Main features: remoting, proxy service, pub/sub over HTTP and JMS 8
9. Ajax Libraries and custom serialization Direct Web Remoting (DWR) Custom serializators based on popular protocol (JSON, XML, YAML, …) Usually build on top of Servlet API or Action frameworks such as Spring MVC 9
11. Google Web Toolkit Current version – 2.2 Evolves, supported by Google Have forks: GWT-Ext, Vaadin, SmartGWT Good tooling: Google Plugin for Eclipse, visual designer Not just for RIA (Odnoklasniki!) Heavy Java orientation Debug and deployment sometimes complicated 11
12. Spring MVC Current version – 3.1 Led by SpringSource – doesn’t evolve Lots of view resolvers Tooling is supported on a Spring Framework level Lots of documentation, implementations and examples 12
13. Java Server Faces Current version – 2.0 Led by JCP (Oracle) Evolves, supported by big companies Painful, but standard Libraries - Apache MyFaces, JbossRichFaces, Oracle ADF Tooling is limited Significant version differences 13
14. Struts 2 and Stripes Action/Request based frameworks Actively developed Struts 2 – Apache project, latest release – 20 Dec 2010 Struts 2 = Struts 1 + WebWork Struts 2 uses OGNL Stripes – latest release – 4 Jan 2011 Some success stories Books, tutorials available 14
15. Tapestry 5 and Wicket Tapestry 5 and Wicket are Apache projects Both are component based Tapestry 5 latest release 15 Nov 2010 Wicket latest release – 21 Jan 2011 Tapestry uses OGNL Wicket is more Java oriented 15
17. Main factors Developer productivity Developer perception Learning curve Project Health Developer Availability Job Trends Templating Components Ajax Plugins or Add-Ons 17
18. Main factors – continued Scalability Testing I18n and i10n Validation Multi-Language support Quality of documentation Books REST support Mobile support Degree of risk 18
19. Comparison High traffic, internet facing, infinite scalability – Action/Request based framework Intranet based, few users, behind firewall – Component based framework Products, to be maintained for 5-10 years – largest community, most vendor support Legacy backend – same language as backend Done by Matt Raible - http://bit.ly/jvm-frameworks-matrix You should have yours! 19
20. Typical frameworks combinations Consider JavaScript libraries YUI/Ext JS/Dojo/jQuery + Action/Request based – gives separation of front end and server side GWT + Spring MVC – gives components and flexibility where necessary JSF + JAX-RS – gives components and REST access for JavaScript UI 20
22. Spring Roo Generates typical combinations between database, models, controllers and views Supports Hibernate, GWT, Spring MVC, Spring Security, Maven, JPA and tons more… Waving can be turned off (remove Spring Roo) Actively developed http://www.springsource.org/roo 22
23. AppFuse Generates basic project using typical combinations Good place to learn best practices Can generate code based on DB schema Somewhat evolving http://appfuse.org 23
24. Custom Factories Use Maven! Use scripting! Use code generators – Skyway Builder, SpringFuse Most companies are doing it right Reuse experience 24
26. Tools Use Eclipse/Idea/NetBeans Maven works, just use the latest version and Maven Shell m2eclipse, jetty plugin or tomcat plugin Use JRebel for zero turnaround Tomcat and Jetty – rocks! 26
27. Architecture Use JavaScript frameworks Use IoC frameworks (Spring, Guice, …) but keep classpath clean Keep session isolated Avoid JSP Minimize Controllers layer Use existing security solutions e.g. Spring Security Each module should have its own Maven artifact 27
28. Friends from neighborhood JRuby on Rails great for prototyping JRubydeveloped by Oracle Groovy on Grails great for new small and medium projects Groovy developed by SpringSource Possible to use existing business login on other languages Learn and apply best practices from non Java frameworks 28
29. Future – Java EE 6 Web Profile Servlet 3.0: Web Fragments, Async API, programmatic methods to add servlets and filters, Annotations, Security enhancements JSP 2.2 / EL 2.2 : method invocations, new properties Web Beans Bean Validation Managed Beans 29