Introduction to Spring Web Flow Andrew Petro Software Developer Unicon, Inc. Jasig 2011 Westminster, CO 23 May 2011 © Copyright Unicon, Inc., 2011. Some.

Slides:



Advertisements
Similar presentations
Apache Struts Technology
Advertisements

INTRODUCTION TO ASP.NET MVC AND EXAMPLE WALKTHROUGH RAJAT ARYA EFECS - OIM DAWG – 4/21/2009 ASP.NET MVC.
Yii – How Power Comes Introduction, OOP & Design Patterns Presented at: Nextbridge Multan Center Aug 25, 2011.
 Copyright Wipro Technologies JSP Ver 1.0 Page 1 Talent Transformation Java Server Pages.
XML Import & Export for uP 2 Using Cernunnos Andrew Petro & Drew Wills April 2007 uPortal Dev Meeting Johns Hopkins University © Copyright Unicon, Inc.,
Feature requests for Case Manager By Spar Nord Bank A/S IBM Insight 2014 Spar Nord Bank A/S1.
Fabian Vilers Hands on ASP.NET MVC.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Immutable Objects and Classes.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 5 - Functions Outline 5.1Introduction 5.2Program.
ASP.NET Programming with C# and SQL Server First Edition
Guide To UNIX Using Linux Third Edition
Apache Struts Technology A MVC Framework for Java Web Applications.
Session-01. Layers Struts 2 Framework The struts 2 framework is used to develop MVC-based web application. Struts 1.0 was released in June The.
Stateful Web Application Development with Spring Web Flow John Case Senior Consultant Centare Group, Ltd.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Struts 2.0 an Overview ( )
UNIT-V The MVC architecture and Struts Framework.
Lecture 2 - Struts ENTERPRISE JAVA. 2 Contents  Servlet Deployment  Servlet Filters  Model View Controllers  Struts  Dependency Injection.
WebWork in Action An introduction to WebWork Patrick A. Lightbody.
Advanced Shell Programming. 2 Objectives Use techniques to ensure a script is employing the correct shell Set the default shell Configure Bash login and.
Spring Overview, Application demo -Midhila Paineni 09/23/2011 Spring Overview, Application demo9/8/20151.
Chapter 4.1 – Deeper into Rails Maciej Mensfeld Presented by: Maciej Mensfeld Deeper into Rails mensfeld.pl github.com/mensfeld senior.
CMSC 202 Exceptions. Aug 7, Error Handling In the ideal world, all errors would occur when your code is compiled. That won’t happen. Errors which.
1 Accelerated Web Development Course JavaScript and Client side programming Day 2 Rich Roth On The Net
Anti Orgla, Nortal AS Spring Framework
Introduction to ASP.NET MVC Information for this presentation was taken from Pluralsight Building Applications with ASP.NET MVC 4.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. C How To Program - 4th edition Deitels Class 05 University.
Lecturer: Prof. Piero Fraternali, Teaching Assistant: Alessandro Bozzon, Advanced Web Technologies: Struts–
ASP.NET Programming with C# and SQL Server First Edition Chapter 3 Using Functions, Methods, and Control Structures.
Spring 2008 Mark Fontenot CSE 1341 Principles of Computer Science I Note Set 2.
JSTL Lec Umair©2006, All rights reserved JSTL (ni) Acronym of  JavaServer Pages Standard Tag Library JSTL (like JSP) is a specification, not an.
CAS Lightning Talk Jasig-Sakai 2012 Tuesday June 12th 2012 Atlanta, GA Andrew Petro - Unicon, Inc.
Introduction to Programming David Goldschmidt, Ph.D. Computer Science The College of Saint Rose Java Methods (a.k.a. Functions)
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Forms with Spring MVC Handling Form.
Chapter 3 Functions, Events, and Control Structures JavaScript, Third Edition.
Reusable and Multiple Actions USINGQTP65-STUDENT-01A.
Mama's Love Bakery Employee and Supplier Record Tracker Co, Roxanne De Leon, Gelvin Dela Cruz, Shannen Rose Haw, Michael.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
CourseOutline Example & JavaBeans Lec Start with Example Displaying Course Outlines User will select either course “web design & development” or.
JavaScript, Fourth Edition
ANDROID AND MODEL / VIEW / CONTROLLER. Slide 2 Design Patters Common solutions to programming problems are called design patterns Design patterns are.
1 Spring Framework April, 2012 Lam Ho Lam To. © 2010 Cisco and/or its affiliates. All rights reserved. Cisco Confidential 2 1.Spring Overview 2.Framework.
Preface IIntroduction Objectives I-2 Course Overview I-3 1Oracle Application Development Framework Objectives 1-2 J2EE Platform 1-3 Benefits of the J2EE.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
JavaServer Faces framework Craig McClanahan is presented that created Struts web framework and based on experience gathered designed JavaServer.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
Written by: Dr. JJ Shepherd
Copyright 2008 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Developing Rich Web Applications with.
Copyright 2007 SpringSource. Copying, publishing or distributing without express written permission is prohibited. Introduction to Spring Web Flow An Overview.
Apache Struts Technology A MVC Framework for Java Web Applications.
BIT 286: Web Applications Lecture 04 : Thursday, January 15, 2015 ASP.Net MVC -
© 2004 Pearson Addison-Wesley. All rights reserved3-1 Objects Declaration: String title;  title (object variable) of type String( Class )  title is just.
111 State Management Beginning ASP.NET in C# and VB Chapter 4 Pages
Thomas Burleson. Using MVC with Flex & Coldfusion Projects June 27, 2007 See how Coldfusion MVC is similar to Flex MVC…
Shibbolizing uPortal and a Path for Delegated Authentication with Shibboleth Tom Barton, Scott Cantor, and Andrew Petro The Ohio State University, University.
Shibbolizing uPortal and a Path for Delegated Authentication with Shibboleth Tom Barton, Scott Cantor, and Andrew Petro The Ohio State University, University.
From Source Code to Packages and even whole distributions By Cool Person From openSUSE.
Annotation-Based Spring Portlet MVC John A. Lewis Chief Software Architect Unicon, Inc. Jasig 2010 Conference 8 March 2010 © Copyright Unicon, Inc., 2010.
Programming Paradigms, Software Architectural Patterns, and MVC CS 378 – Mobile Computing for iOS Dr. William C. Bulko.
Web Technology Solutions
Business rules.
Chapter 5: Enhancing Classes
Identity and Access Management Challenges in uPortal
Play Framework: Introduction
PHP Training at GoLogica in Bangalore
Tuesday Brown Bag Inversion of Control with Howard Abrams
Looping III (do … while statement)
Leveraging ColdSpring To Make Better Applications
Intro to Programming (in JavaScript)
Presentation transcript:

Introduction to Spring Web Flow Andrew Petro Software Developer Unicon, Inc. Jasig 2011 Westminster, CO 23 May 2011 © Copyright Unicon, Inc., Some rights reserved. This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License. To view a copy of this license, visit

2 Spring Web Flow 1.How Spring Web Flow Fits 2.What's a Flow? 3.Spring Web Flow States 4.Forms

3 Why is Spring Web Flow important? uPortal 4 uses Spring Web Flow CAS uses Spring Web Flow Spring Web Flow as viable Portlet development framework Quickly build and maintain wizard / flow Web experiences with panache  Forms, processes, registrations  This is bread and butter self-service IT

4 How Spring Web Flow Fits

5 Sits atop Spring Framework / MVC Spring Web Flow works with the rest of the Spring Framework and Spring WebMVC Diagram credit: Spring Web Flow documentation

6 Purpose of Spring Web Flow Spring Web Flow is good at building flows Which just begs the question, really. Let me get at this another way...

7 Aside: Spring Framework Dependency Injection / Inversion of Control Utilities, templates, helpers For easing all aspects of Java development  Especially Java Web development

8 The Hollywood Principle Image credit CC-BY-NDhttp://

9 Don't Call Us, We'll Call You

10 Dependency Injection Write POJOs. JavaBeans. Spring wires together using XML or Annotations or Autowiring or …  Stop calling static factories. Code becomes more reusable, more flexibly configurable, less repetitive,...

11 Editing Portlet Publications in uPortal 4 RC1 An example of a flow

12 Portlet Management

13 Select Portlet Type

14 Set basic portlet info

15 Portlet Parameters

16 Select Categories

17 Select Users and Groups

18 What's a flow anyway?

19 What's a flow? A flow is a multi-step experience More than one request in making up a logical whole

20 A flow - what Has a beginning (state) and an end (state) Has zero or more intermediary states Has transitions between these states Has its own scope  Can conveniently remember state between these steps until the flow completes and your application is ready to process the whole result

21 Flows - why Re-use multi-step processes Revisit steps in flow  Constrained by allowable state transitions  Stateful!  Flow-scoped state (might) make your application cleaner (not having to model and remember at the persistence/domain layer incomplete state)

22 Re-use subflows

23 Revisit steps in flow

24

25 States and Transitions Views, Decisions, Actions, and Subflows

26 View States Renders a view. By convention, a view with the same name as the id. So, “viewLoginForm.jsp”, e.g.

27 Transitions from a View Cancel

28 Decision States Boolean decision about what state is next

29 Action States

30 Subflow States

31 How it really works Start at a start-state Flow through zero or more action and decision states until you get to another view state. Render it. Repeat previous step. Eventually exit the flow.

32 Ending with a view

33 Ending with a redirect <end-state id=”redirectView” view=”externalRedirect:${requestScope.response.url}” />

34 Ending with return from subflow

35 Setting variables and invoking Java between and within states

36 Expression language

37 Storing result from expression

38 Where can I insert expressions? On flow start On state entry On view render On transition execution On state exit On flow end

39 Forms

40 Form Objects Form objects are POJOs JavaBean properties public String getFname() { return fname; } public void setFname(String name) { fname = name; }...

41 Binding forms to model Model Form fields bind to JavaBean properties of the model Java object.

42 Binding All properties bind by default Bindings can be explicitly declared You can also use a custom binder

43 Binding forms selectively to model Binder Only bind the properties you intend to bind!

44 Selectively bind on transitions Bind attribute on transition You might not bother binding on a cancel, or you might bind but not validate if partial progress completing model.

45 Select Portlet Type

46 Next without required field

47 But cancel doesn't require field

48 Binding forms to model Model Form fields bind to JavaBean properties of the model Java object.

49 Properties can be required

50 CAS login form

51 Required fields

52 Properties can be required

53 Validation Validator for model objects Or Validator for model-in-specific-state As in, you can program custom validators in Java

54 Selectively validate on transitions validate attribute on transition You might bind but not validate if you want to capture the user input but not prevent transition if the input is invalid.

55 Say I pick a portlet type

56 I fill out this form, but...

57 So I pick another portlet type

58 And my form data is right there.

59 Even though it's not valid

60 Selectively validate on transitions validate attribute on transition You might bind but not validate if you want to capture the user input but not prevent transition if the input is invalid.

61 PortletDefinitionForm public class PortletDefinitionForm implements Serializable { public String getFname() { return fname; } public void setFname(String name) { fname = name; }...

62 PortletDefinitionFormValidator public void validate BasicInfo (PortletDefinitionForm def, MessageContext ctx) { if (StringUtils.isEmpty(def.getFname())) { ctx.addMessage(new MessageBuilder().error().source("fName").code("fname.required").build()); } else if (!FunctionalNameType.isValid(def.getFname())) { ctx.addMessage(new MessageBuilder().error().source("fName").code("fname.invalid").build()); }...

63 Validate${viewState}() public void validate BasicInfo (PortletDefinitionForm def, MessageContext ctx) {... }

64 Scopes

65 Scopes Flash scope View Scope Flow Scope Conversation Scope

66 Flash scope Cleared when a view is rendered

67 View Scope Created when enter view-state Destroyed on exit view-state Useful for transient state for rendering the view  That you might need on processing the event fired by the user interaction with the view  Or that you need for re-rendering the view

68 Flow Scope Created when enter flow Destroyed on exit flow Useful for transient state within the flow

69 Conversation scope Persists across returns from subflows

70 Conclusions

71 Spring Web Flow in uPortal 4 Many administrative portlets in uPortal 4 implemented using Spring Web Flow

72 Spring Web Flow in CAS

73 Spring Web Flow for Portlet Dev Works with Spring PortletMVC

74 Spring Web Flow Web Development Quickly develop self-service web flows Update, maintain, and tweak these applications with panache

75 Contact Information Andrew Petro Software Developer Unicon, Inc.