1
votes

I'm playing around with Grails webflow and having surprising difficulty reading param values from the request. I have defined a simple flow as follows:

def testFlow = {

    stepOne{

        String name = params.name

        render(view: "stepTwo", [name: name])
    }
    ... 
}

The problem I'm having is that the name parameter is not resolving to the name value I'm passing in in the request, but rather it is assigned the String value "org.codehaus.groovy.grails.commons.metaclass.PropertyExpression" which is the name of the class of the implicit 'params' object that is present in Grails controllers.

If I put the same parameter assignment in a non-webflow controller closure (i.e. a standard controller closure), the assignment works as you would expect and the 'name' object is assigned the value that I pass in via the request params.

Am I overlooking something glaringly obvious here (wouldn't be the first time) or has anyone else seen the same sort of issue? I have also tried accessing the param value using params['name'] and params.getProperty('name') but in all cases the result is the same.

1

1 Answers

1
votes

Your flow definition/DSL doesn't really look correct. Normally you dont use render() within the DSL, as rendering occurs for you based on your state names. Also, params are typically accessed within an action and/or on closure.

Here is one of the better, short, grails web flow tutorials. Discovering Grails Web Flows