SlideShare a Scribd company logo
1 of 17
Download to read offline
Formio
Need a form?
Radek Beran
Motivation
● I hate solving of repetitive problems where it is not
necessary
● I want to solve them in a simple way
● I want to have an easy to use tool that i can use
anywhere…
Formio | Radek Beran 2
Formio
● Form definition & binding framework
● Easy-to-use configurable handy tool
● Validation of form data (using bean validation)
● Support for file uploads, configurable max. request/file size
● Immutable, composable form definitions
● One simple entry point to API
● Easy integration to existing frameworks
● For environments with or without HttpServletRequest
● Simply unit testable forms
Formio | Radek Beran 3
Simple form example
Formio | Radek Beran 4
private static final FormMapping<Person> personForm =
Forms.automatic(Person.class, "person").build(/* Opt. config */);
…
FormData<Person> formData = new FormData<Person>(
person, ValidationResult.empty);
FormMapping<Person> filledForm = personForm.fill(formData);
// push filledForm to template …
…
FormData<Person> formData = personForm.bind(
new ServletRequestParams(request));
if (formData.isValid()) {
// save person – formData.getData() …
} else {
// fill and show the form again …
}
Formio API
● Forms – entry point
● FormMapping, BasicFormMappingBuilder
● FormField, FieldProps for field definition
● ParamsProvider
● ValidationResult
● ConstraintViolationMessage
● Config
● Formatters, Formatter
● CollectionBuilders, CollectionBuilder,
● BeanExtractor
● Binder, Instantiator, ArgumentNameResolver
● BeanValidator
● PropertyMethodRegex
● UploadedFile
Formio | Radek Beran 5
Data binding
●
Setter and construction method binding
●
Immutable objects supported (Instantiator abstraction)
●
Default or non-default constructors
●
Static factory methods
●
Collections and arrays
●
Complex nested objects and lists of complex objects
●
And arbitrary combination recursively
●
Primitives (and their wrapper classes) supported everywhere
●
String, Enums, BigDecimal, BigInteger, Date supported by default
formatters
Formio | Radek Beran 6
Data for templates (1)
●
Just push the filled form to the template
●
Use its properties
●
validationResult
●
success
●
fieldMessages
●
globalMessages
●
fields – Map<String, FormField>
●
name – unique name/path of mapping
●
labelKey – key for caption of nested complex object carried by
mapping
●
filledObject
●
required
●
nested – map with nested mappings
●
list – list of nested mappings for complex objects if this is
MappingType.LIST mapping
Formio | Radek Beran 7
Data for templates (2)
●
Properties of FormField
●
name – unique name/path of form field
●
labelKey – key for localization of label (name without brackets)
●
filledObject, filledObjects (for group of checkboxes, multiselect)
●
required
Formio | Radek Beran 8
Form definition (1)
Formio | Radek Beran 9
private static final FormMapping<RegDate> regDateMapping =
Forms.basic(RegDate.class, "regDate").fields("month", "year")
.build();
private static final FormMapping<Registration> registrationForm =
Forms.basic(Registration.class, "registration")
// whitelist of properties to bind
.fields("attendanceReasons", "cv", "interests", "email")
.nested(Forms.basic(Address.class, "contactAddress",
Forms.factoryMethod(Address.class, "getInstance"))
.fields("street", "city", "zipCode").build())
.nested(Forms.basic(Collegue.class, "collegues",
null, MappingType.LIST)
.fields("name", "email")
.nested(regDateMapping)
.build())
.build();
Form definition (2)
Formio | Radek Beran 10
Or equivalent automatic one
●
Or equivalent automatic mapping
private static final FormMapping<Registration> registrationForm =
Forms.automatic(Registration.class, "registration")
.nested(Forms.automatic(Address.class, "contactAddress",
Forms.factoryMethod(Address.class, "getInstance")).build())
.build();
• Automatic mapping
● Introspects readable (and settable – via setters/instantiators)
properties (incl. nested objects, list of nested objects)
● @Ignored on getters can be used
● Custom field definitions have precedence
• Custom field definition
Forms.<Date>field("birthDate", "text")
.formatter(CUSTOM_DATE_FORMATTER).build();
Form definition (2)
Validation
●
Using bean validation API (JSR-303)
●
ValidationResult
●
ConstraintViolationMessage(s) for global and field constraints
●
Fields (properties) and also mappings (whole complex objects) are validated
●
Binding and validation errors
●
Custom message bundle can be configured
●
Default are properties for class of form data
●
Fallback to ValidationMessages.properties with default messages
●
Message bundle need not to be used
●
Error messages carry possible translation and also unresolved key with
arguments
Formio | Radek Beran 11
Other validation features
●
Conditional validation
●
Using bean validation groups
●
Custom validators can be written
●
NotEmpty
●
RodneCislo
●
Email
●
CustomMultiFieldValidator, …
●
Error, warning, info severity supported and recognized from payload
of annotations
●
Required flag automatically filled from Size, NotNull and derived
constaints in default validator implementation
●
For FormFields
●
For mappings of complex objects
Formio | Radek Beran 12
Configuration
●
Config object (Created using Forms.config()…build())
●
Immutable
●
Default configuration available
●
Custom configuration can be supplied
●
Automatically propagated to nested mappings
Formio | Radek Beran 13
File uploads
●
Using Apache FileUpload API
●
Max. request size, size of one uploaded file, threshold for storing
data in memory can be set via Formio API
●
Global/field ConstraintViolationMessages created when limits are
exceeded
●
Automatic binding to UploadedFile, collections/arrays of
UploadedFile(s)
●
UploadedFileWrapper as a complex object for indexed lists of
uploaded files (nested list mappings)
Formio | Radek Beran 14
What about AJAX?
●
AJAX compatible
●
You can expose server methods/API for update of state called from client
●
On the server: Form definition can be filled with current data updated with
sent data
●
Filled nested mapping (inc. its validation result) can be sent back to client
●
Cooperating AJAX framework can be used
●
Twinstone TDI, jQuery, …
Formio | Radek Beran 15
Formio vs. Spring
● Formio Pros:
● Even easier to learn and use than forms in Spring
● Functional form processing, immutable/composable/reusable form definitions
● Immutable view/domain objects can be used (via constructors, static factory
methods), arbitrarily nested – no need for custom Spring MVC
WebArgumentResolver(s) or HttpMessageConverter(s)
● Minimum of dependencies (bean validation, fileupload)
● Message bundle for form data class with fallback to common ValidationMessages
● Not bound to any particular UI architecture like MVC, but fully usable in Spring
MVC or other frameworks
● Automatic construction of form field names/paths, also for nested objects/lists
● Self-contained independent object representation of a form
● Cons:
● Spring is widely used and offers usable solution in Spring MVC
Formio | Radek Beran 16
Q & A?
Formio | Radek Beran 17
Documentation: http://www.formio.net
Demo: http://formio-demo.herokuapp.com/

More Related Content

What's hot

Node.js Event Loop & EventEmitter
Node.js Event Loop & EventEmitterNode.js Event Loop & EventEmitter
Node.js Event Loop & EventEmitterSimen Li
 
Project report - Web Browser in Java by Devansh Koolwal
Project report - Web Browser in Java by Devansh KoolwalProject report - Web Browser in Java by Devansh Koolwal
Project report - Web Browser in Java by Devansh KoolwalDevansh Koolwal
 
Event Management System Document
Event Management System Document Event Management System Document
Event Management System Document LJ PROJECTS
 
Attendance Monitoring System of Marinduque Academy Inc.
Attendance Monitoring System of Marinduque Academy Inc.Attendance Monitoring System of Marinduque Academy Inc.
Attendance Monitoring System of Marinduque Academy Inc.Christel Jane Del Prado
 
system requirements for android projects
system requirements for android projectssystem requirements for android projects
system requirements for android projectsparry prabhu
 
Virtual Job Portal System
Virtual Job Portal SystemVirtual Job Portal System
Virtual Job Portal SystemTAWSEEF AHMAD
 
Resume of Md Sajedul Islam
Resume of Md Sajedul IslamResume of Md Sajedul Islam
Resume of Md Sajedul Islamsajedulislam
 
InduSoft Web Studio and OPC UA Connectivity
InduSoft Web Studio and OPC UA ConnectivityInduSoft Web Studio and OPC UA Connectivity
InduSoft Web Studio and OPC UA ConnectivityAVEVA
 
Canteen management system
Canteen management systemCanteen management system
Canteen management systemConsultonmic
 
Capstone Project Student Management System
Capstone Project Student Management SystemCapstone Project Student Management System
Capstone Project Student Management SystemDonna Muller
 
Doctrine ORM Internals. UnitOfWork
Doctrine ORM Internals. UnitOfWorkDoctrine ORM Internals. UnitOfWork
Doctrine ORM Internals. UnitOfWorkIllia Antypenko
 
Simple callcenter platform with PHP
Simple callcenter platform with PHPSimple callcenter platform with PHP
Simple callcenter platform with PHPMorten Amundsen
 
Quill vs Slick Smackdown
Quill vs Slick SmackdownQuill vs Slick Smackdown
Quill vs Slick SmackdownAlexander Ioffe
 
Redis & ZeroMQ: How to scale your application
Redis & ZeroMQ: How to scale your applicationRedis & ZeroMQ: How to scale your application
Redis & ZeroMQ: How to scale your applicationrjsmelo
 
Clean Code summary
Clean Code summaryClean Code summary
Clean Code summaryJan de Vries
 
UML Diagrams for Real estate management system
UML Diagrams for Real estate management systemUML Diagrams for Real estate management system
UML Diagrams for Real estate management systemStarlee Lathong
 

What's hot (20)

Node.js Event Loop & EventEmitter
Node.js Event Loop & EventEmitterNode.js Event Loop & EventEmitter
Node.js Event Loop & EventEmitter
 
Project report - Web Browser in Java by Devansh Koolwal
Project report - Web Browser in Java by Devansh KoolwalProject report - Web Browser in Java by Devansh Koolwal
Project report - Web Browser in Java by Devansh Koolwal
 
Online Examination System with remote proctoring
Online Examination System  with remote proctoringOnline Examination System  with remote proctoring
Online Examination System with remote proctoring
 
Event Management System Document
Event Management System Document Event Management System Document
Event Management System Document
 
Attendance Monitoring System of Marinduque Academy Inc.
Attendance Monitoring System of Marinduque Academy Inc.Attendance Monitoring System of Marinduque Academy Inc.
Attendance Monitoring System of Marinduque Academy Inc.
 
system requirements for android projects
system requirements for android projectssystem requirements for android projects
system requirements for android projects
 
Virtual Job Portal System
Virtual Job Portal SystemVirtual Job Portal System
Virtual Job Portal System
 
Resume of Md Sajedul Islam
Resume of Md Sajedul IslamResume of Md Sajedul Islam
Resume of Md Sajedul Islam
 
InduSoft Web Studio and OPC UA Connectivity
InduSoft Web Studio and OPC UA ConnectivityInduSoft Web Studio and OPC UA Connectivity
InduSoft Web Studio and OPC UA Connectivity
 
Canteen management system
Canteen management systemCanteen management system
Canteen management system
 
Capstone Project Student Management System
Capstone Project Student Management SystemCapstone Project Student Management System
Capstone Project Student Management System
 
Mini Project presentation for MCA
Mini Project presentation for MCAMini Project presentation for MCA
Mini Project presentation for MCA
 
Doctrine ORM Internals. UnitOfWork
Doctrine ORM Internals. UnitOfWorkDoctrine ORM Internals. UnitOfWork
Doctrine ORM Internals. UnitOfWork
 
Madrid meetup #7 deployment models
Madrid meetup #7   deployment modelsMadrid meetup #7   deployment models
Madrid meetup #7 deployment models
 
Simple callcenter platform with PHP
Simple callcenter platform with PHPSimple callcenter platform with PHP
Simple callcenter platform with PHP
 
Quill vs Slick Smackdown
Quill vs Slick SmackdownQuill vs Slick Smackdown
Quill vs Slick Smackdown
 
Jithender_3+Years_Exp_ETL Testing
Jithender_3+Years_Exp_ETL TestingJithender_3+Years_Exp_ETL Testing
Jithender_3+Years_Exp_ETL Testing
 
Redis & ZeroMQ: How to scale your application
Redis & ZeroMQ: How to scale your applicationRedis & ZeroMQ: How to scale your application
Redis & ZeroMQ: How to scale your application
 
Clean Code summary
Clean Code summaryClean Code summary
Clean Code summary
 
UML Diagrams for Real estate management system
UML Diagrams for Real estate management systemUML Diagrams for Real estate management system
UML Diagrams for Real estate management system
 

Similar to Formio - form definition & binding library for Java platform

XPages - The Ties That Bind
XPages - The Ties That BindXPages - The Ties That Bind
XPages - The Ties That BindMichael McGarel
 
Cloud data loading
Cloud data loadingCloud data loading
Cloud data loadingFeras Ahmad
 
Pdf template Invoice
Pdf template InvoicePdf template Invoice
Pdf template Invoicenm2allen
 
Symfony Form Basics - OroMeetup #3 Cherkassy
Symfony Form Basics - OroMeetup #3 CherkassySymfony Form Basics - OroMeetup #3 Cherkassy
Symfony Form Basics - OroMeetup #3 CherkassyAndrew Yatsenko
 
Webform and Drupal 8
Webform and Drupal 8Webform and Drupal 8
Webform and Drupal 8Philip Norton
 
Day 6.1 and_6.2__flat_files_and_service_api
Day 6.1 and_6.2__flat_files_and_service_apiDay 6.1 and_6.2__flat_files_and_service_api
Day 6.1 and_6.2__flat_files_and_service_apitovetrivel
 
Sitecore xDB - Architecture and Configuration
Sitecore xDB - Architecture and ConfigurationSitecore xDB - Architecture and Configuration
Sitecore xDB - Architecture and ConfigurationCodersCenter
 
Using jQuery to Maximize Form Usability
Using jQuery to Maximize Form UsabilityUsing jQuery to Maximize Form Usability
Using jQuery to Maximize Form UsabilityMark Rackley
 
Angular Reactive Forms vs React Redux Form
Angular Reactive Forms vs React Redux Form Angular Reactive Forms vs React Redux Form
Angular Reactive Forms vs React Redux Form Briisk
 
Best practices in using Salesforce Metadata API
Best practices in using Salesforce Metadata APIBest practices in using Salesforce Metadata API
Best practices in using Salesforce Metadata APISanchit Dua
 
Flows - what you should know before implementing
Flows - what you should know before implementingFlows - what you should know before implementing
Flows - what you should know before implementingDoria Hamelryk
 
MuleSoft London Community February 2020 - MuleSoft and OData
MuleSoft London Community February 2020 - MuleSoft and ODataMuleSoft London Community February 2020 - MuleSoft and OData
MuleSoft London Community February 2020 - MuleSoft and ODataPace Integration
 
C# .NET Developer Portfolio
C# .NET Developer PortfolioC# .NET Developer Portfolio
C# .NET Developer Portfoliocummings49
 
Performance in .net best practices
Performance in .net best practicesPerformance in .net best practices
Performance in .net best practicesCodecamp Romania
 
Oracle ADF Quick Handy Reference
Oracle ADF Quick Handy ReferenceOracle ADF Quick Handy Reference
Oracle ADF Quick Handy ReferenceDeepak Bhagat
 
Visual Studio 2010 and .NET 4.0 Overview
Visual Studio 2010 and .NET 4.0 OverviewVisual Studio 2010 and .NET 4.0 Overview
Visual Studio 2010 and .NET 4.0 Overviewbwullems
 

Similar to Formio - form definition & binding library for Java platform (20)

SAP Adobe forms
SAP Adobe formsSAP Adobe forms
SAP Adobe forms
 
C#Portfolio
C#PortfolioC#Portfolio
C#Portfolio
 
XPages - The Ties That Bind
XPages - The Ties That BindXPages - The Ties That Bind
XPages - The Ties That Bind
 
Cloud data loading
Cloud data loadingCloud data loading
Cloud data loading
 
Pdf template Invoice
Pdf template InvoicePdf template Invoice
Pdf template Invoice
 
Symfony Form Basics - OroMeetup #3 Cherkassy
Symfony Form Basics - OroMeetup #3 CherkassySymfony Form Basics - OroMeetup #3 Cherkassy
Symfony Form Basics - OroMeetup #3 Cherkassy
 
Webform and Drupal 8
Webform and Drupal 8Webform and Drupal 8
Webform and Drupal 8
 
Day 6.1 and_6.2__flat_files_and_service_api
Day 6.1 and_6.2__flat_files_and_service_apiDay 6.1 and_6.2__flat_files_and_service_api
Day 6.1 and_6.2__flat_files_and_service_api
 
Dbms fast track 2/3
Dbms fast track 2/3Dbms fast track 2/3
Dbms fast track 2/3
 
Sitecore xDB - Architecture and Configuration
Sitecore xDB - Architecture and ConfigurationSitecore xDB - Architecture and Configuration
Sitecore xDB - Architecture and Configuration
 
Using jQuery to Maximize Form Usability
Using jQuery to Maximize Form UsabilityUsing jQuery to Maximize Form Usability
Using jQuery to Maximize Form Usability
 
Angular Reactive Forms vs React Redux Form
Angular Reactive Forms vs React Redux Form Angular Reactive Forms vs React Redux Form
Angular Reactive Forms vs React Redux Form
 
Best practices in using Salesforce Metadata API
Best practices in using Salesforce Metadata APIBest practices in using Salesforce Metadata API
Best practices in using Salesforce Metadata API
 
Flows - what you should know before implementing
Flows - what you should know before implementingFlows - what you should know before implementing
Flows - what you should know before implementing
 
MuleSoft London Community February 2020 - MuleSoft and OData
MuleSoft London Community February 2020 - MuleSoft and ODataMuleSoft London Community February 2020 - MuleSoft and OData
MuleSoft London Community February 2020 - MuleSoft and OData
 
C# .NET Developer Portfolio
C# .NET Developer PortfolioC# .NET Developer Portfolio
C# .NET Developer Portfolio
 
Performance in .net best practices
Performance in .net best practicesPerformance in .net best practices
Performance in .net best practices
 
Oracle ADF Quick Handy Reference
Oracle ADF Quick Handy ReferenceOracle ADF Quick Handy Reference
Oracle ADF Quick Handy Reference
 
Visual Studio 2010 and .NET 4.0 Overview
Visual Studio 2010 and .NET 4.0 OverviewVisual Studio 2010 and .NET 4.0 Overview
Visual Studio 2010 and .NET 4.0 Overview
 
Django introduction
Django introductionDjango introduction
Django introduction
 

More from Etnetera

Pavel Ševčík: Microdata a rich snippets
Pavel Ševčík: Microdata a rich snippetsPavel Ševčík: Microdata a rich snippets
Pavel Ševčík: Microdata a rich snippetsEtnetera
 
Dalibor Pulkert: Mobile marketing 2015
Dalibor Pulkert: Mobile marketing 2015Dalibor Pulkert: Mobile marketing 2015
Dalibor Pulkert: Mobile marketing 2015Etnetera
 
Dalibor Pulkert: Mobilní Džungle
Dalibor Pulkert: Mobilní DžungleDalibor Pulkert: Mobilní Džungle
Dalibor Pulkert: Mobilní DžungleEtnetera
 
LinuxDays 2014: Social Engineering
LinuxDays 2014: Social EngineeringLinuxDays 2014: Social Engineering
LinuxDays 2014: Social EngineeringEtnetera
 
Jiří Štěpán: Nebojte se být osobní i u vás doma na webu
Jiří Štěpán: Nebojte se být osobní i u vás doma na webuJiří Štěpán: Nebojte se být osobní i u vás doma na webu
Jiří Štěpán: Nebojte se být osobní i u vás doma na webuEtnetera
 
Vlastimil Menčík: Scala from the Trenches
Vlastimil Menčík: Scala from the TrenchesVlastimil Menčík: Scala from the Trenches
Vlastimil Menčík: Scala from the TrenchesEtnetera
 
Zbyněk Hraše: Pokročilá personalizace na cestě k efektivitě
Zbyněk Hraše: Pokročilá personalizace na cestě k efektivitěZbyněk Hraše: Pokročilá personalizace na cestě k efektivitě
Zbyněk Hraše: Pokročilá personalizace na cestě k efektivitěEtnetera
 
Krev net a_slzy
Krev net a_slzyKrev net a_slzy
Krev net a_slzyEtnetera
 

More from Etnetera (8)

Pavel Ševčík: Microdata a rich snippets
Pavel Ševčík: Microdata a rich snippetsPavel Ševčík: Microdata a rich snippets
Pavel Ševčík: Microdata a rich snippets
 
Dalibor Pulkert: Mobile marketing 2015
Dalibor Pulkert: Mobile marketing 2015Dalibor Pulkert: Mobile marketing 2015
Dalibor Pulkert: Mobile marketing 2015
 
Dalibor Pulkert: Mobilní Džungle
Dalibor Pulkert: Mobilní DžungleDalibor Pulkert: Mobilní Džungle
Dalibor Pulkert: Mobilní Džungle
 
LinuxDays 2014: Social Engineering
LinuxDays 2014: Social EngineeringLinuxDays 2014: Social Engineering
LinuxDays 2014: Social Engineering
 
Jiří Štěpán: Nebojte se být osobní i u vás doma na webu
Jiří Štěpán: Nebojte se být osobní i u vás doma na webuJiří Štěpán: Nebojte se být osobní i u vás doma na webu
Jiří Štěpán: Nebojte se být osobní i u vás doma na webu
 
Vlastimil Menčík: Scala from the Trenches
Vlastimil Menčík: Scala from the TrenchesVlastimil Menčík: Scala from the Trenches
Vlastimil Menčík: Scala from the Trenches
 
Zbyněk Hraše: Pokročilá personalizace na cestě k efektivitě
Zbyněk Hraše: Pokročilá personalizace na cestě k efektivitěZbyněk Hraše: Pokročilá personalizace na cestě k efektivitě
Zbyněk Hraše: Pokročilá personalizace na cestě k efektivitě
 
Krev net a_slzy
Krev net a_slzyKrev net a_slzy
Krev net a_slzy
 

Recently uploaded

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 

Recently uploaded (20)

Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 

Formio - form definition & binding library for Java platform

  • 2. Motivation ● I hate solving of repetitive problems where it is not necessary ● I want to solve them in a simple way ● I want to have an easy to use tool that i can use anywhere… Formio | Radek Beran 2
  • 3. Formio ● Form definition & binding framework ● Easy-to-use configurable handy tool ● Validation of form data (using bean validation) ● Support for file uploads, configurable max. request/file size ● Immutable, composable form definitions ● One simple entry point to API ● Easy integration to existing frameworks ● For environments with or without HttpServletRequest ● Simply unit testable forms Formio | Radek Beran 3
  • 4. Simple form example Formio | Radek Beran 4 private static final FormMapping<Person> personForm = Forms.automatic(Person.class, "person").build(/* Opt. config */); … FormData<Person> formData = new FormData<Person>( person, ValidationResult.empty); FormMapping<Person> filledForm = personForm.fill(formData); // push filledForm to template … … FormData<Person> formData = personForm.bind( new ServletRequestParams(request)); if (formData.isValid()) { // save person – formData.getData() … } else { // fill and show the form again … }
  • 5. Formio API ● Forms – entry point ● FormMapping, BasicFormMappingBuilder ● FormField, FieldProps for field definition ● ParamsProvider ● ValidationResult ● ConstraintViolationMessage ● Config ● Formatters, Formatter ● CollectionBuilders, CollectionBuilder, ● BeanExtractor ● Binder, Instantiator, ArgumentNameResolver ● BeanValidator ● PropertyMethodRegex ● UploadedFile Formio | Radek Beran 5
  • 6. Data binding ● Setter and construction method binding ● Immutable objects supported (Instantiator abstraction) ● Default or non-default constructors ● Static factory methods ● Collections and arrays ● Complex nested objects and lists of complex objects ● And arbitrary combination recursively ● Primitives (and their wrapper classes) supported everywhere ● String, Enums, BigDecimal, BigInteger, Date supported by default formatters Formio | Radek Beran 6
  • 7. Data for templates (1) ● Just push the filled form to the template ● Use its properties ● validationResult ● success ● fieldMessages ● globalMessages ● fields – Map<String, FormField> ● name – unique name/path of mapping ● labelKey – key for caption of nested complex object carried by mapping ● filledObject ● required ● nested – map with nested mappings ● list – list of nested mappings for complex objects if this is MappingType.LIST mapping Formio | Radek Beran 7
  • 8. Data for templates (2) ● Properties of FormField ● name – unique name/path of form field ● labelKey – key for localization of label (name without brackets) ● filledObject, filledObjects (for group of checkboxes, multiselect) ● required Formio | Radek Beran 8
  • 9. Form definition (1) Formio | Radek Beran 9 private static final FormMapping<RegDate> regDateMapping = Forms.basic(RegDate.class, "regDate").fields("month", "year") .build(); private static final FormMapping<Registration> registrationForm = Forms.basic(Registration.class, "registration") // whitelist of properties to bind .fields("attendanceReasons", "cv", "interests", "email") .nested(Forms.basic(Address.class, "contactAddress", Forms.factoryMethod(Address.class, "getInstance")) .fields("street", "city", "zipCode").build()) .nested(Forms.basic(Collegue.class, "collegues", null, MappingType.LIST) .fields("name", "email") .nested(regDateMapping) .build()) .build();
  • 10. Form definition (2) Formio | Radek Beran 10 Or equivalent automatic one ● Or equivalent automatic mapping private static final FormMapping<Registration> registrationForm = Forms.automatic(Registration.class, "registration") .nested(Forms.automatic(Address.class, "contactAddress", Forms.factoryMethod(Address.class, "getInstance")).build()) .build(); • Automatic mapping ● Introspects readable (and settable – via setters/instantiators) properties (incl. nested objects, list of nested objects) ● @Ignored on getters can be used ● Custom field definitions have precedence • Custom field definition Forms.<Date>field("birthDate", "text") .formatter(CUSTOM_DATE_FORMATTER).build(); Form definition (2)
  • 11. Validation ● Using bean validation API (JSR-303) ● ValidationResult ● ConstraintViolationMessage(s) for global and field constraints ● Fields (properties) and also mappings (whole complex objects) are validated ● Binding and validation errors ● Custom message bundle can be configured ● Default are properties for class of form data ● Fallback to ValidationMessages.properties with default messages ● Message bundle need not to be used ● Error messages carry possible translation and also unresolved key with arguments Formio | Radek Beran 11
  • 12. Other validation features ● Conditional validation ● Using bean validation groups ● Custom validators can be written ● NotEmpty ● RodneCislo ● Email ● CustomMultiFieldValidator, … ● Error, warning, info severity supported and recognized from payload of annotations ● Required flag automatically filled from Size, NotNull and derived constaints in default validator implementation ● For FormFields ● For mappings of complex objects Formio | Radek Beran 12
  • 13. Configuration ● Config object (Created using Forms.config()…build()) ● Immutable ● Default configuration available ● Custom configuration can be supplied ● Automatically propagated to nested mappings Formio | Radek Beran 13
  • 14. File uploads ● Using Apache FileUpload API ● Max. request size, size of one uploaded file, threshold for storing data in memory can be set via Formio API ● Global/field ConstraintViolationMessages created when limits are exceeded ● Automatic binding to UploadedFile, collections/arrays of UploadedFile(s) ● UploadedFileWrapper as a complex object for indexed lists of uploaded files (nested list mappings) Formio | Radek Beran 14
  • 15. What about AJAX? ● AJAX compatible ● You can expose server methods/API for update of state called from client ● On the server: Form definition can be filled with current data updated with sent data ● Filled nested mapping (inc. its validation result) can be sent back to client ● Cooperating AJAX framework can be used ● Twinstone TDI, jQuery, … Formio | Radek Beran 15
  • 16. Formio vs. Spring ● Formio Pros: ● Even easier to learn and use than forms in Spring ● Functional form processing, immutable/composable/reusable form definitions ● Immutable view/domain objects can be used (via constructors, static factory methods), arbitrarily nested – no need for custom Spring MVC WebArgumentResolver(s) or HttpMessageConverter(s) ● Minimum of dependencies (bean validation, fileupload) ● Message bundle for form data class with fallback to common ValidationMessages ● Not bound to any particular UI architecture like MVC, but fully usable in Spring MVC or other frameworks ● Automatic construction of form field names/paths, also for nested objects/lists ● Self-contained independent object representation of a form ● Cons: ● Spring is widely used and offers usable solution in Spring MVC Formio | Radek Beran 16
  • 17. Q & A? Formio | Radek Beran 17 Documentation: http://www.formio.net Demo: http://formio-demo.herokuapp.com/