The Web Flow plugin integrates Spring Web Flow with Grails.
grails-plugins / grails-webflow-plugin Goto Github PK
View Code? Open in Web Editor NEWThis project forked from burtbeckwith/grails-webflow
Grails Web Flow Plugin
License: Other
This project forked from burtbeckwith/grails-webflow
Grails Web Flow Plugin
License: Other
The Web Flow plugin integrates Spring Web Flow with Grails.
Hi,
I'm migrating a shopping cart checkout to use the webflow plugin. The former implementation used to perform validation of the order's delivery address using a custom UserDetailsCommand
object which included a AddressCommand address
property, as shown below:
@Validateable
class UserDetailsCommand implements Serializable {
String firstName
String lastName
AddressCommand deliveryAddress
...
static constraints = {
firstName nullable: false, blank: false, size: 1..50
lastName nullable: false, blank: false, size: 1..50
deliveryAddress cascade:true
...
}
...
}
@Validateable
class AddressCommand implements Serializable {
String address1
String address2
String city
String county
String postcode
static constraints = {
address1 blank:false, size: 1..50
address2 blank:false, size: 1..50
city blank:false, size: 1..50
county blank:false, size: 1..50
postcode blank:false, matches: /[A-Za-z]{1,2}[0-9Rr][0-9A-Za-z]?\s?[0-9][ABD-HJLNP-UW-Zabd-hjlnp-uw-z]{2}/
}
}
After migrating to use the webflow plugin I realised that the address field on the UserDetailsCommand
was always coming as null
on my transitions and actions, failing therefore validation (in an incorrect way) even though the parameters names seemed to be correct (eg. ["firstName:"David", "deliveryAddress.address1": "10 Downing Street"]
).
My webflow now looks something like:
class CartController {
def checkoutFlow = {
startCheckout {
action {
...
}
on("success").to "deliveryDetails"
}
deliveryDetails {
on("proceed") { UserDetailsCommand userDetailsCommand ->
...
}
}
...
}
...
}
I believe this set up is correct and there's an issue on the plugin's data binding. If not, could you please provide indications on what I'm doing wrong?
Cheers!
Is there any timeline to upgrade it to grails 3 ?
IS there already some beta release for grails 3 ?
We are facing an issue with WebFlow when working under Java 8. It works fine with Java 7. We get the stacktrace as given below (given that all the inputs are the same from the screen):
org.springframework.webflow.execution.ActionExecutionException: Exception thrown executing org.codehaus.groovy.grails.webflow.engine.builder.ClosureInvokingAction@1f11a4e5 in state 'EDITED' of flow 'EDITED' -- action execution attributes were 'map[[empty]]'
at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:189)
at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
We tried this with JDK 1.8.0_60 and Grails 2.5.1
we are facing one issue where all the flows are not registered in flowRegistry many times during server startup and it causes NoSuchFlowDefinitionException.
Upon debugging in detail, found that webflow plugin relies on the population of 'flows' property in controllerClasses to populate the flowRegistry:
https://github.com/grails-plugins/grails-webflow-plugin/blob/master/src/groovy/org/codehaus/groovy/grails/webflow/WebFlowPluginSupport.groovy#L116
Based on the debugging done, 'flows' is populated by 'controllers' grails plugin. Here:
https://github.com/jeffbrown/grails-core/blob/master/grails-plugin-controllers/src/main/groovy/org/codehaus/groovy/grails/plugins/web/ControllersGrailsPlugin.groovy#L199
if webflow plugin loads before controllers plugin then all the flows are not detected.
So if controllers is the only plugin which can populate the required data for webflow plugin, then webflow plugin should 'loadAfter' entry for 'controllers' plugin.
We are using grails version 2.4.3 and webflow version 2.1.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.