Extreme Web Productivity with Spring Roo

16,810 views

Published on

Discussion of the Web UI features in Spring Roo. Spring Roo is a Java-based rapid application development framework. This presentation was given by me at SpringOne 2GX Americas in October 09.

Published in: Technology
1 Comment
5 Likes
Statistics
Notes
  • See http://www.slideshare.net/benalexau/introduction-to-spring-roo-100-2805183 for a more introductory presentation on Spring Roo 1.0.0, or http://www.slideshare.net/benalexau/spring-roo-100-technical-deep-dive if you'd like to learn about the technical internals that power the tool.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
16,810
On SlideShare
0
From Embeds
0
Number of Embeds
5,590
Actions
Shares
0
Downloads
396
Comments
1
Likes
5
Embeds 0
No embeds

No notes for slide

Extreme Web Productivity with Spring Roo

  1. 1. Extreme Web Productivity with Spring Roo Stefan Schmidt - SpringSource
  2. 2. Agenda •  Example Application •  Roo Web Features & Details •  Add-on Demonstrations •  Spring Roo Roadmap SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  3. 3. Agenda •  Example Application •  Roo Pizza Shop •  Roo Web Features •  Add-on Demonstrations •  Spring Roo Roadmap SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  4. 4. Pizza Shop Domain Model SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  5. 5. Roo Pizza Shop Script project --topLevelPackage com.springsource.pizzashop persistence setup --provider HIBERNATE --database MYSQL database properties set --key database.url --value jdbc:mysql://localhost:3306/pizza database properties set --key database.username --value root entity --class ~.domain.Topping --testAutomatically field string --fieldName name --notNull --sizeMin 2 entity --class ~.domain.Base --testAutomatically field string --fieldName name --notNull --sizeMin 2 entity --class ~.domain.Pizza --testAutomatically field string --fieldName name --notNull --sizeMin 2 field number --type java.lang.Double --fieldName price --min 0 --primitive field reference --type ~.domain.Base --fieldName base --notNull field set --element ~.domain.Topping --fieldName toppings --cardinality MANY_TO_MANY entity --class ~.domain.PizzaOrder –testAutomatically field string --fieldName name --notNull --sizeMin 2 field string --fieldName address --sizeMax 50 field date --type java.util.Date --fieldName deliveryDate --class ~.domain.PizzaOrder field set --element ~.domain.Pizza --fieldName pizzas --sizeMin 1 field number --type java.lang.Double --fieldName total --min 0 --primitive controller all --package ~.web logging setup --level DEBUG --package WEB selenium test --controller com.springsource.pizzashop.web.BaseController finder add --finderName findPizzasByToppingsAndPriceLessThan --class ~.domain.Pizza security setup controller scaffold --class ~.web.PublicPizzaController --path /public/pizza --disallowedOperations create,update,delete --entity ~.domain.Pizza web flow SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  6. 6. Demonstration Creating the domain model SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  7. 7. Agenda •  Example Application •  Roo Web Features & Details •  Web Architecture •  Web Artifacts •  Commands •  Directory Layout •  REST URI Mappings •  Add-on Demonstrations •  Spring Roo Roadmap SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  8. 8. Web Architecture •  Controllers interact with Domain entities •  OpenEntityManagerInViewFilter •  "Open EntityManager in View" pattern •  JPA EntityManager bound to the thread for the entire processing of the request •  allow for lazy loading in web views •  original transactions already being completed •  Service layer optional •  used for business logic spanning multiple entities SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  9. 9. Web Artifacts •  Java & Aspects •  Spring MVC @Controllers •  Property Editors •  JSPX •  clear format and structuring •  fully XML compliant •  Spring JS & Dojo •  client-side validation •  form usability improvements SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  10. 10. Web Artifacts (cont.) •  CSS •  flexible UI customization •  Apache Tiles •  flexible templating of jspx pages •  Tags •  reusable pagination •  theme selectors •  language selectors •  URLRewrite Filter •  simplification of URIs SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  11. 11. Web Artifacts (cont.) •  XML •  configuration of various technologies •  Spring MVC & WebFlow application contexts •  Tiles configurations •  web.xml •  Properties Files •  internationalization support via message properties •  theming configuration SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  12. 12. Roo Web Commands •  Generation of Web artifacts •  controller scaffold •  generate a controller for a given entity •  controller all •  generate controllers for all entities without an existing controller •  controller class •  generate a simple Spring @MVC controller with a post and a get method SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  13. 13. Demonstration The Web directory SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  14. 14. Web Project Directory Layout •  All web-related artifacts in src/main/webapp SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  15. 15. Web Project Directory Layout Directory Purpose /styles style sheets (CSS) /images graphics /WEB-INF/classes/*.properties theme configurations /WEB-INF/spring/*.xml Web-related Spring application contexts /WEB-INF/i18n/*.properties internationalization message files /WEB-INF/layouts/layout.jspx Tiles definition for master layout /WEB-INF/tags/*.tagx Tag libraries (pagination, language, etc) /WEB-INF/views/**/* Tiles and other view artifacts /WEB-INF/web.xml Web application context /WEB-INF/urlrewrite.xml URL rewrite filter configuration SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  16. 16. REST URI Mapping Resource GET PUT POST DELETE Create a new List the members of topping in the Collection URI such as the collection. For collection where http://domain.com/ example list all the Not used. Not used. the ID is assigned pizzashop/topping/ toppings available in automatically by the application. the collection. Update the Delete the Member URI such as Retrieve the addressed addressed addressed http://domain.com/ Not used. topping with id=5 topping with topping pizzashop/topping/5 id=5. with id=5. Member URI such as Create Form - returns http://domain.com/ an initialized, but Not used. Not used. Not used. pizzashop/topping/ empty topping for form form binding. Member URI such as Update Form returns http://domain.com/ the topping resource Not used. Not used. Not used. pizzashop/topping/5/ which is pre-populated form for form binding SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  17. 17. Agenda •  Example Application •  Roo Web Features & Details •  Add-on Demonstrations •  Selenium Tests •  Dynamic Finders •  Spring Security •  Web Flow •  Spring Roo Roadmap SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  18. 18. Demonstration Selenium Tests Dynamic Finders Spring Security Spring Web Flow SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  19. 19. @RooWebScaffold @RooWebScaffold( path = "public/order", automaticallyMaintainView = true, formBackingObject = PizzaOrder.class, update = false, delete = false, create = true, exposeFinders = true, dateFormat = “dd-MM-yyyy”) @RequestMapping("/public/order/**") @Controller public class PublicPizzaOrderController { }! roo> controller scaffold --name ~.web.PublicPizzaOrderController --entity ~.domain.PizzaOrder -- path public/pizza --disallowedOperations update,delete --dateFormat dd-MM-yyyy SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  20. 20. Agenda •  Example Application •  Roo Web Features & Details •  Testing & Securing Views •  Web Flow •  Spring Roo Roadmap SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  21. 21. Roadmap •  Ordering & sorting of entities •  Form field & menu ordering •  Ajax (partial page refresh) •  Content negotiation •  UI usability and look & feel enhancements •  Drop-in templating •  Spring Blaze DS & Flex UI •  Google Web Toolkit UI •  Comet & Bayeux Note: The information on the roadmap is intended to outline our general product direction and should not be incorporated into any contract. Copyright 2009 SpringSource. Copying, publishing or distributing without express written permission is prohibited. SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  22. 22. Project Resources •  Home •  http://www.springsource.org/roo •  Contains links to all other resources •  Forum •  http://forum.springsource.org •  Roo team actively monitor forum and answer queries •  Issues •  http://jira.springframework.org/browse/ROO •  Twitter •  #roo hash key •  follow @schmidtstefan & @benalexau SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.
  23. 23. Q&A SpringOne 2GX 2009. All rights reserved. Do not distribute without permission.

×